2017 © Pedro Peláez
 

library automaton

Task Scheduler for Laravel 4.x

image

plateau/automaton

Task Scheduler for Laravel 4.x

  • Tuesday, August 26, 2014
  • by marvin-bot
  • Repository
  • 1 Watchers
  • 10 Stars
  • 113 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Laravel 4 Automaton Task Scheduler

Latest Stable Version Total Downloads License, (*1)

Automaton is a task Scheduler for Laravel 4 designed to run as a CronJob. It's designed to run resource intensive tasks with PHP CLI while providing a user friendly way to track down the execution of the tasks., (*2)

The planned tasks are stored in a database table, and are 'sandboxed' so any exception occuring will be logged into the database for easier debugging., (*3)

Installation

Add this into require-dev in your composer.json file:, (*4)

"require-dev" : {
    ...
    "plateau/automaton": "dev-master"
}

Run an update:, (*5)

php composer.phar update

Register the console service provider in app/config/app.php:, (*6)

'providers' => array(
    ...
    'Plateau\Automaton\AutomatonServiceProvider',
);

Register the facade :, (*7)

    'Automaton' => 'Plateau\Automaton\AutomatonFacade',
);

Run migrations, (*8)

php artisan migrate --package=plateau/automaton

Usage

Configure your crontab to run Automaton at a regular interval :, (*9)

* * * * * php /var/www/laravel-app/artisan automaton:run >/dev/null 2>&1

Create a task class that contains your logic :, (*10)

use Plateau\Automaton\AbstractTask;

class MyTask extends AbstractTask {

    public function fire()
    {
        // Task logic
    }
}

Schedule your task :, (*11)

// Parameters are accessible from the task object as $this->parameters
$parameters = array('key' => 'value');

$myTask = new MyTask;
$myTask->init($parameters);

Automaton::schedule($myTask, '2014-02-17 12:00:00');

Alternatively you can pass a Carbon object for setting the date :, (*12)

Automaton::schedule($myTask, Carbon::now->addHours(2));

Scheduling Cron Jobs

If you need your tasks to be run at regular intervals, you can pass cron expression to the scheduler :, (*13)

// Run a task every minute
Automaton::cron($myTask, '* * * * *');

Happy Coding!, (*14)

The Versions

26/08 2014

dev-master

9999999-dev

Task Scheduler for Laravel 4.x

  Sources   Download

MIT

The Requires

 

by Plateau Creations

laravel task scheduler cron automation

22/03 2014

v0.3

0.3.0.0

Task Scheduler for Laravel 4.x

  Sources   Download

MIT

The Requires

 

by Plateau Creations

laravel task scheduler cron automation

14/02 2014

v0.2

0.2.0.0

Task Scheduler for Laravel 4.x

  Sources   Download

MIT

The Requires

 

by Plateau Creations

laravel task scheduler cron automation

14/02 2014

v0.1

0.1.0.0

  Sources   Download

The Requires

 

by Plateau Creations