swoole.php 556 B

1234567891011121314151617181920
  1. <?php
  2. use App\Kernel;
  3. $_SERVER['APP_RUNTIME_OPTIONS'] = [
  4. 'host' => '0.0.0.0',
  5. 'port' => 8080,
  6. 'mode' => SWOOLE_BASE,
  7. 'settings' => [
  8. \Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2,
  9. \Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
  10. \Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public'
  11. ],
  12. ];
  13. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  14. return function (array $context): Kernel {
  15. return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  16. };