Laravel Scheduling Package

Laravel 是在 App\Console\Kernel 类中的 schedule 方法去定义全部的调度任务。php

iBrand 产品做为一个电商类产品,自己业务需求很是庞大和复杂,所有定义在 schedule 方法中会很是臃肿。并且 iBrand 产品的每一个模块都是一个 Package,具备高度的复用性。laravel

因此咱们开发了此包,用来把各个模块的调度任务放在本身的包里,而不是所有放在 App\Console\Kernel类的 schedule 方法中。git

github: ibrandcc/laravel-schedulinggithub

Installation

$ composer require ibrand/laravel-scheduling -vvvapp

If your Laravel version below 5.5, you need add the follow line to the section providers of config/app.php:composer

iBrand\Scheduling\ServiceProvider::class,ide

Usage

extend Scheduling abstract class


use iBrand\Scheduling\Scheduling;ui

class YourSchedule extends Scheduling {this

    public function schedule(){
        
        //Your schedule logic.
        $this->schedule->call(function () {
        
        })->daily();
    }

 spa

register

Add follow line to you ServiceProvider register method.

 $this->app->make(iBrand\Scheduling\ScheduleList::class)->add(YourSchedule::class);

欢迎你们 star 和提交 issue :)
 

讨论交流

相关文章
相关标签/搜索