laravels.php 3.8 KB

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