mennen-online / laravel-queue-watcher
当本地PHP文件更改时自动重启队列
1.0.4
2024-09-06 14:58 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^9.0|^10.0|^11.0
- spatie/file-system-watcher: ^1.1.1
- spatie/laravel-package-tools: ^1.13.6
Requires (Dev)
- laravel/pint: ^1.2
- nunomaduro/collision: ^6.3.1
- orchestra/testbench: ^7.11
- pestphp/pest: ^1.22.1
- pestphp/pest-plugin-laravel: ^1.3
- phpunit/phpunit: ^9.5.26
- spatie/laravel-ray: ^1.31
README
本包受spatie/laravel-horizon-watcher启发,包含Artisan命令queue:watch
,该命令将启动默认队列工作进程,并在任何PHP文件被创建、更新或删除时自动重启它。
您还可以使用--queue=
选项来定义要监控的其他队列而不是默认队列。
要禁用作业和队列超时,请使用带有值0的--timeout=
选项。
此命令旨在在本地环境中使用。
安装
您可以通过composer安装此包
composer require mennen-online/laravel-queue-watcher --dev
这是已发布配置文件的内容
return [ /* * Laravel Queue will be restarted when any PHP file inside these directories * get created, updated or deleted. You can also specify other kinds * of files here. */ 'paths' => [ app_path(), config_path(), database_path(), resource_path('views'), base_path('.env'), base_path('composer.lock'), ], /* * This command will be executed to start Laravel Queue. */ 'command' => 'php artisan queue:work', ];
使用方法
运行php artisan queue:watch
以启动默认队列。当项目中的PHP文件被创建、更新或删除时,队列将自动重启。
运行php artisan queue:watch --queue=another_queue
以启动another_queue并自动重启。
运行php artisan queue:watch --timeout=0
以禁用队列工作进程超时。
测试
composer test
致谢
- Freek Van der Herten为本包的启发
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。