cyub/laravel-task-scheduler

An Lightweight Laravel Task Scheduling Package
29 4
Install
composer require cyub/laravel-task-scheduler
Latest Version:0.1.0
PHP:>=5.4.0
License:MIT
Last Updated:Apr 19, 2019
Links: GitHub  ·  Packagist
Maintainer: cyub

Laravel 5 Lightweight Task Scheduler

An Lightweight Task Scheduler Package for Laravel 5. This package allows you to dispatch all scheduled jobs and run at the time.

Installation

Require the package

composer require "cyub/laravel-task-scheduler"

After adding the package, add the ServiceProvider to the providers array in config/app.php

'providers' => [
    ...
    Tink\Scheduler\SchedulerServiceProvider::class,
    ...
];

Then, publish the scheduler config and migration the database of scheduler

php artisan scheduler:install

Configuration

After Install the package, You will find the Configuration in config\scheduler.php

return [
    'enable' => true,
    'schedule_table_name' => 'cron_schedule',
    'schedule_generate_every' => 1,
    'schedule_ahead_for' => 50,
    'schedule_lifetime' => 15,
    'history_cleanup_every' => 10,
    'history_success_lifetime' => 600,
    'history_failure_lifetime' => 600,

    'schedules' => [
        'RegisterRedpacket.activate' => [
            'schedule'  => [
                'cron_expr'   => '*/1 * * * *',
            ],
            'run'   => [
                'class' => App\Cron\RegisterRedpacket::class,
                'function'  => 'activate',
                'params'    => ['isSendSmsNotice' => true]
            ],
            'description' => 'activate register redpacket'
        ]
    ]
];

Usage

Dispatch job and run

php artisan scheduler:dispatch

You can use in Cron

* * * * * php /your-application-path/artisan scheduler:dispatch >> /dev/null 2>&1

View the scheduler config

php artisan scheduler:info config

scheduler config

View the scheduler run result stats

php artisan scheduler:info stats

scheduler config

Clean the scheduler cache

php artisan scheduler:clean

Related Packages

reliese/laravel

Reliese Components for Laravel Framework code generation.

3,954,390 1,705
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,312 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

366,462 86
laravel/laravel

The skeleton application for the Laravel framework.

64,738,171 84,935