laravels.php 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * @see https://github.com/hhxsv5/laravel-s/blob/master/Settings-CN.md Chinese
  4. * @see https://github.com/hhxsv5/laravel-s/blob/master/Settings.md English
  5. */
  6. return [
  7. 'listen_ip' => env('LARAVELS_LISTEN_IP', '127.0.0.1'),
  8. 'listen_port' => env('LARAVELS_LISTEN_PORT', 5200),
  9. 'socket_type' => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1,
  10. 'enable_coroutine_runtime' => false,
  11. 'server' => env('LARAVELS_SERVER', 'LaravelS'),
  12. 'handle_static' => env('LARAVELS_HANDLE_STATIC', false),
  13. 'laravel_base_path' => env('LARAVEL_BASE_PATH', base_path()),
  14. 'inotify_reload' => [
  15. 'enable' => env('LARAVELS_INOTIFY_RELOAD', false),
  16. 'watch_path' => base_path(),
  17. 'file_types' => ['.php'],
  18. 'excluded_dirs' => [],
  19. 'log' => true,
  20. ],
  21. 'event_handlers' => [
  22. 'WorkerStart' => \App\Events\WorkerStartEvent::class,
  23. ],
  24. 'websocket' => [
  25. 'enable' => true,
  26. 'handler' => \App\Services\WebSocketService::class,
  27. ],
  28. 'sockets' => [],
  29. 'processes' => [
  30. //[
  31. // 'class' => \App\Processes\TestProcess::class,
  32. // 'redirect' => false, // Whether redirect stdin/stdout, true or false
  33. // 'pipe' => 0 // The type of pipeline, 0: no pipeline 1: SOCK_STREAM 2: SOCK_DGRAM
  34. // 'enable' => true // Whether to enable, default true
  35. //],
  36. ],
  37. 'timer' => [
  38. 'enable' => env('LARAVELS_TIMER', false),
  39. 'jobs' => [
  40. // Enable LaravelScheduleJob to run `php artisan schedule:run` every 1 minute, replace Linux Crontab
  41. //\Hhxsv5\LaravelS\Illuminate\LaravelScheduleJob::class,
  42. // Two ways to configure parameters:
  43. // [\App\Jobs\XxxCronJob::class, [1000, true]], // Pass in parameters when registering
  44. // \App\Jobs\XxxCronJob::class, // Override the corresponding method to return the configuration
  45. ],
  46. 'max_wait_time' => 5,
  47. ],
  48. 'swoole_tables' => [],
  49. 'register_providers' => [],
  50. 'cleaners' => [
  51. // See LaravelS's built-in cleaners: https://github.com/hhxsv5/laravel-s/blob/master/Settings.md#cleaners
  52. ],
  53. 'destroy_controllers' => [
  54. 'enable' => false,
  55. 'excluded_list' => [
  56. //\App\Http\Controllers\TestController::class,
  57. ],
  58. ],
  59. 'swoole' => [
  60. 'daemonize' => env('LARAVELS_DAEMONIZE', false),
  61. 'dispatch_mode' => 2,
  62. 'reactor_num' => env('LARAVELS_REACTOR_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 4),
  63. 'worker_num' => env('LARAVELS_WORKER_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8),
  64. 'task_worker_num' => env('LARAVELS_TASK_WORKER_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8),
  65. 'task_ipc_mode' => 1,
  66. 'task_max_request' => env('LARAVELS_TASK_MAX_REQUEST', 8000),
  67. 'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
  68. 'max_request' => env('LARAVELS_MAX_REQUEST', 8000),
  69. 'open_tcp_nodelay' => true,
  70. 'pid_file' => storage_path('laravels.pid'),
  71. 'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
  72. 'log_level' => 4,
  73. 'document_root' => base_path('public'),
  74. 'buffer_output_size' => 2 * 1024 * 1024,
  75. 'socket_buffer_size' => 128 * 1024 * 1024,
  76. 'package_max_length' => 4 * 1024 * 1024,
  77. 'reload_async' => true,
  78. 'max_wait_time' => 60,
  79. 'enable_reuse_port' => true,
  80. 'enable_coroutine' => false,
  81. 'http_compression' => false,
  82. // Slow log
  83. // 'request_slowlog_timeout' => 2,
  84. // 'request_slowlog_file' => storage_path(sprintf('logs/slow-%s.log', date('Y-m'))),
  85. // 'trace_event_worker' => true,
  86. 'heartbeat_idle_time' => 600,
  87. 'heartbeat_check_interval' => 60,
  88. /**
  89. * More settings of Swoole
  90. * @see https://wiki.swoole.com/#/server/setting Chinese
  91. * @see https://www.swoole.co.uk/docs/modules/swoole-server/configuration English
  92. */
  93. ],
  94. ];