Enhanced logging and distributed capabilities for Laravel's scheduler.
micahpotter/laravel-enhanced-scheduler is a Laravel package for enhanced logging and distributed capabilities for laravel's scheduler..
It currently has 0 GitHub stars and 0 downloads on Packagist.
Install it with composer require micahpotter/laravel-enhanced-scheduler.
Discover more Laravel packages by micahpotter
or browse all Laravel packages to compare alternatives.
Last updated
The package is distributed internally with Satis. First add the repository to composer.json:
"repositories": [
{
"type": "composer",
"url": "https://satis.myriadmobile.com"
}
]
Require the package with composer using the following command:
composer require myriad/laravel-enhanced-scheduler
After updating composer, add the service provider to the providers array in config/app.php:
Myriad\Illuminate\Console\Scheduling\EnhancedSchedulerServiceProvider::class,
Rather than creating your own migrations, you can publish the ones from the package:
php artisan vendor:publish --provider=myriad/laravel-enhanced-scheduler --tag=migrations
Finally, to make the scheduler actually use the enhanced scheduler,
simply use the trait in app/Console/Kernel.php
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Myriad\Illuminate\Console\Scheduling\EnhancedScheduler;
class Kernel extends ConsoleKernel {
use EnhancedScheduler;
...
}
The enhanced scheduler is designed to work out of the box without additional configuration.
Should you need to edit the configuration, publish the config file to the config directory:
php artisan vendor:publish --provider=myriad/laravel-enhanced-scheduler --tag=config
Use the enhanced scheduler exactly as you would the Laravel scheduler.
Simply register your schedules in the schedules method!
New methods:
->withoutDistributedOverlapping($task)
Uses a distributed locking mechanism to ensure that the event is only run on one node in a cluster.
The $task should be a unique name to identify the entry across the cluster. e.g. my-nightly-task.
->withoutLog()
Use when you don't want an event logged.
->withoutLogOutput()
Use when you want to log an event, but not the output. This is useful for events with very long output or when you just don't care.
->failOnNonZeroExit($task)
Use to ensure that a command exited cleanly. Only for use with commands.