Laravel Scheduling Package

为了解决iBrand电商产品在Laravel框架下调度任务过于集中的问题,开发了一个新的包,允许各模块独立管理调度任务,提高代码组织性和复用性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

iBrand 产品作为一个电商类产品,本身业务需求非常庞大和复杂,全部定义在 schedule 方法中会非常臃肿。而且 iBrand 产品的每个模块都是一个 Package,具有高度的复用性。

所以我们开发了此包,用来把各个模块的调度任务放在自己的包里,而不是全部放在 App\Console\Kernel 类的 schedule 方法中。

github: guojiangclub/laravel-scheduling

Installation

$ composer require ibrand/laravel-scheduling -vvv

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

iBrand\Scheduling\ServiceProvider::class,

Usage

extend Scheduling abstract class


use iBrand\Scheduling\Scheduling;

class YourSchedule extends Scheduling {

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

register

Add follow line to you ServiceProvider register method.

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

欢迎大家 star 和提交 issue ?

讨论交流

联系我们

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值