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-09-28 00:26:55 UTC
README
为使用 Symfony 应用程序和基于 Swoole 的 Php Swoole Runtime 的运行时。
如果您是首次接触 Symfony 运行时组件,请在 主要 README 中了解更多信息。
仍在开发中
安装
composer require sflightning/runtime
使用
为您的应用程序定义环境变量 APP_RUNTIME
。
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']); };
使用选项
您可以使用 Symfony 的运行时 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']); };