laravels.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. 'websocket' => [
  23. 'enable' => false,
  24. //'handler' => XxxWebSocketHandler::class,
  25. ],
  26. 'sockets' => [],
  27. 'processes' => [
  28. //[
  29. // 'class' => \App\Processes\TestProcess::class,
  30. // 'redirect' => false, // Whether redirect stdin/stdout, true or false
  31. // 'pipe' => 0 // The type of pipeline, 0: no pipeline 1: SOCK_STREAM 2: SOCK_DGRAM
  32. // 'enable' => true // Whether to enable, default true
  33. //],
  34. ],
  35. 'timer' => [
  36. 'enable' => env('LARAVELS_TIMER', false),
  37. 'jobs' => [
  38. // Enable LaravelScheduleJob to run `php artisan schedule:run` every 1 minute, replace Linux Crontab
  39. //\Hhxsv5\LaravelS\Illuminate\LaravelScheduleJob::class,
  40. // Two ways to configure parameters:
  41. // [\App\Jobs\XxxCronJob::class, [1000, true]], // Pass in parameters when registering
  42. // \App\Jobs\XxxCronJob::class, // Override the corresponding method to return the configuration
  43. ],
  44. 'max_wait_time' => 5,
  45. ],
  46. 'events' => [],
  47. 'swoole_tables' => [],
  48. 'register_providers' => [],
  49. 'cleaners' => [
  50. Hhxsv5\LaravelS\Illuminate\Cleaners\SessionCleaner::class,
  51. Hhxsv5\LaravelS\Illuminate\Cleaners\AuthCleaner::class,
  52. Hhxsv5\LaravelS\Illuminate\Cleaners\MenuCleaner::class,
  53. ],
  54. 'destroy_controllers' => [
  55. 'enable' => false,
  56. 'excluded_list' => [
  57. //\App\Http\Controllers\TestController::class,
  58. ],
  59. ],
  60. 'swoole' => [
  61. 'daemonize' => env('LARAVELS_DAEMONIZE', false),
  62. 'dispatch_mode' => 2,
  63. 'reactor_num' => env('LARAVELS_REACTOR_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 4),
  64. 'worker_num' => env('LARAVELS_WORKER_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8),
  65. //'task_worker_num' => env('LARAVELS_TASK_WORKER_NUM', function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8),
  66. 'task_ipc_mode' => 1,
  67. 'task_max_request' => env('LARAVELS_TASK_MAX_REQUEST', 8000),
  68. 'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
  69. 'max_request' => env('LARAVELS_MAX_REQUEST', 8000),
  70. 'open_tcp_nodelay' => true,
  71. 'pid_file' => storage_path('laravels.pid'),
  72. 'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
  73. 'log_level' => 4,
  74. 'document_root' => base_path('public'),
  75. 'buffer_output_size' => 2 * 1024 * 1024,
  76. 'socket_buffer_size' => 128 * 1024 * 1024,
  77. 'package_max_length' => 4 * 1024 * 1024,
  78. 'reload_async' => true,
  79. 'max_wait_time' => 60,
  80. 'enable_reuse_port' => true,
  81. 'enable_coroutine' => false,
  82. 'http_compression' => false,
  83. // Slow log
  84. // 'request_slowlog_timeout' => 2,
  85. // 'request_slowlog_file' => storage_path(sprintf('logs/slow-%s.log', date('Y-m'))),
  86. // 'trace_event_worker' => true,
  87. /**
  88. * More settings of Swoole
  89. *
  90. * @see https://wiki.swoole.com/wiki/page/274.html Chinese
  91. * @see https://www.swoole.co.uk/docs/modules/swoole-server/configuration English
  92. */
  93. ],
  94. ];