xlerr / task
yii2 task
Installs: 585
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:yii2-extension
This package has no released version yet, and little information is available.
README
安装
composer require xlerr/task
配置
// console/config/main.php 'controllerMap' => [ 'task' => \xlerr\task\console\TaskController::class, ], // backend/config/main.php 'modules' => [ 'task' => \xlerr\task\Module::class, ],
管理页面
启动后台服务
php -S 127.0.0.1:9900 -t backend/web
服务启动后, 访问 http://127.0.0.1:9900/task
打开task管理页面
创建异步执行任务
\xlerr\task\DemoTaskHandler::make([ 'name' => 'abcd', ], [ 'task_priority' => \xlerr\task\models\Task::PRIORITY_1, ]);
控制台调用./yii task/process-all
执行任务
创建同步执行任务
(new \xlerr\task\DemoTaskHandler())->invoke([ 'name' => 'abcd, ]); // 输出`abcd`