LaravelPackages.net
Acme Inc.
Toggle sidebar
micahpotter/laravel-enhanced-scheduler

Enhanced logging and distributed capabilities for Laravel's scheduler.

0
0
About micahpotter/laravel-enhanced-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

Laravel Enhanced Scheduler

Install

Add Myriad Repository

The package is distributed internally with Satis. First add the repository to composer.json:

  "repositories": [
    {
      "type": "composer",
      "url": "https://satis.myriadmobile.com"
    }
  ]

Require the Dependency

Require the package with composer using the following command:

composer require myriad/laravel-enhanced-scheduler

Install Service Provider

After updating composer, add the service provider to the providers array in config/app.php:

Myriad\Illuminate\Console\Scheduling\EnhancedSchedulerServiceProvider::class,

Publish Migrations

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

Use The Trait

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;
  
  ...
  
}

Configuration

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

Usage

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.

Star History Chart