CodeIgniter 4 的任务调度器

dev-develop 2024-09-09 12:07 UTC

This package is auto-updated.

Last update: 2024-09-09 12:08:14 UTC


README

CodeIgniter 4 的任务调度器。

PHPUnit PHPStan Deptrac Coverage Status

PHP CodeIgniter License

安装

通过 Composer 安装

composer require codeigniter4/tasks

迁移数据库

对于 Unix

php spark migrate -n CodeIgniter\\Settings

对于 Windows

php spark migrate -n CodeIgniter\Settings

配置

发布配置文件

php spark tasks:publish

定义任务

init() 方法中定义您的任务

// app/Config/Tasks.php
<?php

namespace Config;

use CodeIgniter\Tasks\Config\Tasks as BaseTasks;
use CodeIgniter\Tasks\Scheduler;

class Tasks extends BaseTasks
{
    /**
     * Register any tasks within this method for the application.
     *
     * @param Scheduler $schedule
     */
    public function init(Scheduler $schedule)
    {
        $schedule->command('demo:refresh --all')->mondays('11:00 pm');
    }
}

文档

阅读完整文档: https://tasks.codeigniter.net.cn

贡献

我们接受并鼓励社区以任何形式进行贡献。无论您是否能编写代码、编写文档或帮助寻找错误,所有贡献都受欢迎。请参阅 CONTRIBUTING.md 文件以获取详细信息。