Laravel 是在 App\Console\Kernel 類中的 schedule 方法去定義全部的調度任務。php
iBrand 產品做爲一個電商類產品,自己業務需求很是龐大和複雜,所有定義在 schedule 方法中會很是臃腫。並且 iBrand 產品的每一個模塊都是一個 Package,具備高度的複用性。laravel
因此咱們開發了此包,用來把各個模塊的調度任務放在本身的包裏,而不是所有放在 App\Console\Kernel類的 schedule 方法中。git
github: ibrandcc/laravel-schedulinggithub
$ 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
use iBrand\Scheduling\Scheduling;ui
class YourSchedule extends Scheduling {this
public function schedule(){
//Your schedule logic.
$this->schedule->call(function () {
})->daily();
}
}
spa
Add follow line to you ServiceProvider register method.
$this->app->make(iBrand\Scheduling\ScheduleList::class)->add(YourSchedule::class);
歡迎你們 star 和提交 issue :)