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. '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. //],
  33. ],
  34. 'timer' => [
  35. 'enable' => false,
  36. 'jobs' => [
  37. // Enable LaravelScheduleJob to run `php artisan schedule:run` every 1 minute, replace Linux Crontab
  38. //\Hhxsv5\LaravelS\Illuminate\LaravelScheduleJob::class,
  39. // Two ways to configure parameters:
  40. // [\App\Jobs\XxxCronJob::class, [1000, true]], // Pass in parameters when registering
  41. // \App\Jobs\XxxCronJob::class, // Override the corresponding method to return the configuration
  42. ],
  43. 'max_wait_time' => 5,
  44. ],
  45. 'events' => [],
  46. 'swoole_tables' => [],
  47. 'register_providers' => [
  48. App\Providers\ViewServiceProvider::class
  49. ],
  50. 'cleaners' => [
  51. Hhxsv5\LaravelS\Illuminate\Cleaners\SessionCleaner::class, // If you use the session or authentication in your project, please uncomment this line
  52. Hhxsv5\LaravelS\Illuminate\Cleaners\AuthCleaner::class, // If you use the authentication or passport in your project, please uncomment this line
  53. //Hhxsv5\LaravelS\Illuminate\Cleaners\JWTCleaner::class, // If you use the package "tymon/jwt-auth" in your project, please uncomment this line
  54. // ...
  55. ],
  56. 'destroy_controllers' => [
  57. 'enable' => false,
  58. 'excluded_list' => [
  59. //\App\Http\Controllers\TestController::class,
  60. ],
  61. ],
  62. 'swoole' => [
  63. 'daemonize' => env('LARAVELS_DAEMONIZE', false),
  64. 'dispatch_mode' => 2,
  65. 'reactor_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 4,
  66. 'worker_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8,
  67. //'task_worker_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8,
  68. 'task_ipc_mode' => 1,
  69. 'task_max_request' => 8000,
  70. 'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
  71. 'max_request' => 8000,
  72. 'open_tcp_nodelay' => true,
  73. 'pid_file' => storage_path('laravels.pid'),
  74. 'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
  75. 'log_level' => 4,
  76. 'document_root' => base_path('public'),
  77. 'buffer_output_size' => 2 * 1024 * 1024,
  78. 'socket_buffer_size' => 128 * 1024 * 1024,
  79. 'package_max_length' => 4 * 1024 * 1024,
  80. 'reload_async' => true,
  81. 'max_wait_time' => 60,
  82. 'enable_reuse_port' => true,
  83. 'enable_coroutine' => false,
  84. 'http_compression' => false,
  85. // Slow log
  86. // 'request_slowlog_timeout' => 2,
  87. // 'request_slowlog_file' => storage_path(sprintf('logs/slow-%s.log', date('Y-m'))),
  88. // 'trace_event_worker' => true,
  89. /**
  90. * More settings of Swoole
  91. * @see https://wiki.swoole.com/wiki/page/274.html Chinese
  92. * @see https://www.swoole.co.uk/docs/modules/swoole-server/configuration English
  93. */
  94. ],
  95. ];