Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frameworks/PHP/spiral/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Debug mode disabled view cache and enabled higher verbosity.
APP_ENV=prod
DEBUG=false
DB_DSN=mysql:host=tfb-database:3306;charset=utf8;dbname=hello_world;user=benchmarkdbuser;password=benchmarkdbpass

Expand Down
2 changes: 2 additions & 0 deletions frameworks/PHP/spiral/.rr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ rpc:
listen: tcp://127.0.0.1:6001

server:
on_init:
command: "php app.php cycle"
command: "php app.php"
relay: pipes

Expand Down
13 changes: 11 additions & 2 deletions frameworks/PHP/spiral/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@
declare(strict_types=1);

use App\App;
use Spiral\Core\Container;
use Spiral\Core\Options;

\mb_internal_encoding('UTF-8');
\error_reporting(E_ALL | E_STRICT ^ E_DEPRECATED);
\error_reporting(E_ALL ^ E_DEPRECATED);
\ini_set('display_errors', 'stderr');

// Register Composer's auto loader.
require __DIR__ . '/vendor/autoload.php';

// Initialize shared container, bindings, directories and etc.
$app = App::create(directories: ['root' => __DIR__])->run();
$options = new Options();
$options->validateArguments = false;
$options->allowSingletonsRebinding = true;
$container = new Container(options: $options);
$app = App::create(
directories: ['root' => __DIR__],
container: $container,
)->run();

if ($app === null) {
exit(255);
Expand Down
52 changes: 52 additions & 0 deletions frameworks/PHP/spiral/app/config/cycle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

use Cycle\ORM\SchemaInterface;

/** @see \Spiral\Cycle\Config\CycleConfig */
return [
'schema' => [
/**
* true (Default) - Schema will be stored in a cache after compilation.
* It won't be changed after entity modification. Use `php app.php cycle` to update schema.
*
* false - Schema won't be stored in a cache after compilation.
* It will be automatically changed after entity modification. (Development mode)
*/
'cache' => true,

/**
* The CycleORM provides the ability to manage default settings for
* every schema with not defined segments
*/
'defaults' => [
SchemaInterface::MAPPER => \Cycle\ORM\Mapper\Mapper::class,
SchemaInterface::REPOSITORY => \Cycle\ORM\Select\Repository::class,
SchemaInterface::SCOPE => null,
SchemaInterface::TYPECAST_HANDLER => [
\Cycle\ORM\Parser\Typecast::class
],
],

'collections' => [
'default' => 'array',
'factories' => [
'array' => new \Cycle\ORM\Collection\ArrayCollectionFactory(),
// 'doctrine' => new \Cycle\ORM\Collection\DoctrineCollectionFactory(),
// 'illuminate' => new \Cycle\ORM\Collection\IlluminateCollectionFactory(),
],
],

/**
* Schema generators (Optional)
* null (default) - Will be used schema generators defined in bootloaders
*/
'generators' => null,
],

/**
* Prepare all internal ORM services (mappers, repositories, typecasters...)
*/
'warmup' => \env('RR_MODE') !== null,
];
9 changes: 0 additions & 9 deletions frameworks/PHP/spiral/app/src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ class App extends Kernel
*/
protected const LOAD = [
// Core Services
Bootloader\DebugBootloader::class,
Bootloader\SnapshotsBootloader::class,

// Security and validation
Bootloader\Security\EncrypterBootloader::class,
Bootloader\Security\FiltersBootloader::class,
Bootloader\Security\GuardBootloader::class,

RoadRunnerBridge\HttpBootloader::class,

// HTTP extensions
Expand All @@ -59,8 +52,6 @@ class App extends Kernel
// Template engine
Stempler\StemplerBootloader::class,

Scaffolder\ScaffolderBootloader::class,

// Framework commands
Bootloader\CommandBootloader::class,
RoadRunnerBridge\CommandBootloader::class,
Expand Down
8 changes: 0 additions & 8 deletions frameworks/PHP/spiral/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
"spiral/roadrunner-bridge": "^3.0",
"spiral/roadrunner-cli": "^2.4"
},
"scripts": {
"post-create-project-cmd": [
"php -r \"copy('.env.sample', '.env');\"",
"php app.php encrypt:key -m .env",
"php app.php configure -vv",
"rr get-binary --quiet"
]
},
"autoload": {
"psr-4": {
"App\\": "app/src/"
Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/spiral/spiral.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3-cli
FROM php:8.4-cli

RUN apt-get update -yqq > /dev/null && apt-get install -yqq git unzip > /dev/null
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
Expand All @@ -9,7 +9,7 @@ RUN docker-php-ext-install \
sockets > /dev/null

# RoadRunner >= 2024.x.x requires protobuf extensions to be installed
ARG PROTOBUF_VERSION="4.26.1"
ARG PROTOBUF_VERSION="4.30.1"
RUN pecl channel-update pecl.php.net
RUN MAKEFLAGS="-j $(nproc)" pecl install protobuf-${PROTOBUF_VERSION} > /dev/null

Expand All @@ -22,7 +22,7 @@ RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --q

# pre-configure
RUN ./vendor/bin/rr get-binary > /dev/null 2>&1
RUN php app.php configure > /dev/null 2>&1
RUN php app.php configure

EXPOSE 8080

Expand Down
Loading