mennen-online/laravel-queue-watcher

当本地PHP文件更改时自动重启队列

1.0.4 2024-09-06 14:58 UTC

This package is auto-updated.

Last update: 2024-09-06 14:59:23 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

本包受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

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。