sflightning / runtime
Lightning runtime
dev-main
2022-05-27 19:18 UTC
Requires
- php: >=7.3
- sflightning/contracts: dev-main
- symfony/runtime: ^5.3 || ^6.0
Requires (Dev)
- illuminate/http: ^8.48
- swoole/ide-helper: ^4.6
- symfony/http-foundation: ^5.3 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/phpunit-bridge: ^5.3
Conflicts
- ext-swoole: <4.6.0
This package is auto-updated.
Last update: 2024-10-28 00:36:28 UTC
README
A runtime for Symfony applications using Swoole. Based on the Php Swoole Runtime.
If you are new to the Symfony Runtime component, read more in the main readme.
Still in development
Installation
composer require sflightning/runtime
Usage
Define the environment variable APP_RUNTIME
for your application.
APP_RUNTIME=Sflightning\Runtime\LightningRuntime
Symfony
// public/index.php use App\Kernel; require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; return function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); };
Using Options
You can define some configurations using Symfony's Runtime APP_RUNTIME_OPTIONS
API.
// public/index.php use App\Kernel; $_SERVER['APP_RUNTIME_OPTIONS'] = [ 'host' => '0.0.0.0', 'port' => 9501, 'mode' => SWOOLE_BASE, 'settings' => [ \Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2, \Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true, \Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public' ], ]; require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; return function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); };