signifly / laravel-scheduling-tasks
Organize your Laravel scheduling tasks.
Installs: 7 149
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 4
Forks: 2
Open Issues: 1
Requires
- php: ^7.2.5|^8.0
- illuminate/console: ^8.0|^9.0|^10.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^7.0|^8.0|^9.0|^10.0
README
The signifly/laravel-scheduling-tasks
package allows you to easily organize your scheduling tasks and comes with a handy make:task
command.
Below is a small example of how to use it.
// Inside the app/Console/Kernel.php file add this use Signifly\SchedulingTasks\Facades\TaskLoader; protected function schedule(Schedule $schedule) { TaskLoader::loadFor($schedule); }
In order to make a new task, use the command that comes with the package:
$ php artisan make:task BackupDaily
It generates a new task located at app/Console/Tasks/BackupDaily.php
, which can be configured this way:
<?php namespace App\Console\Tasks; use Signifly\SchedulingTasks\TaskContract; use Illuminate\Console\Scheduling\Schedule; class BackupDaily implements TaskContract { public function __invoke(Schedule $schedule) { $schedule->command('backup:run') ->daily() ->at('01:00'); } }
In case you have a task that you want to exclude from getting loaded, it can be achieved like this:
protected function schedule(Schedule $schedule) { TaskLoader::loadFor($schedule, [ \App\Console\Tasks\BackupDaily::class, ]); // \App\Console\Tasks\BackupDaily::class will not get loaded. }
Installation
You can install the package via composer:
$ composer require signifly/laravel-scheduling-tasks
The package will automatically register itself.
Testing
$ composer test
Security
If you discover any security issues, please email dev@signifly.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.