shifft/background

此包的最新版本(1.0.2)没有可用的许可信息。

在后台运行laravel命令的包

1.0.2 2023-11-07 08:42 UTC

This package is not auto-updated.

Last update: 2024-09-24 12:55:24 UTC


README

这是什么?

此包允许laravel在后台运行laravel命令

入门指南

要开始使用,使用 composer require shifft/background 安装包,并通过 php artisan vendor:publish --tag=config 发布配置文件。

请修改 config/background.php 以匹配您的配置。

用法

在文件顶部包含以下代码

use Shifft\Background\Background;

然后这样使用它

Background::runInBackround('list', 'listPid');//run the artisan list command with the process id(pid) listPid. The pid can be anything you want
Background::isRunning('listPid');//check if the process with the pid listPid is still running

要清理pid文件,已创建background:cleanup命令,应通过在控制台Kernel调度命令中添加以下行来安排。

$schedule->command('background:cleanup')
		 ->dailyAt('0:00');