dev-master
9999999-dev http://github.com/pcrumm/cronyPHP-based cron manager
MIT
The Requires
- php >=5.4
- hellogerard/jobby dev-master
The Development Requires
by Phil Crumm
cli cron
PHP-based cron manager
Crony
is a PHP-based cron job framework. Add the master task to your crontab, and Crony
will take care of all of the work necessary to ensure that your offline jobs run how you want them, when you want them., (*1)
composer
.Add Jobby
to composer.json
., (*2)
"pcrumm/crony": "dev-master"
, (*3)
Run composer install
, (*4)
Add the following to your crontab (see below for an example jobs.php
:, (*5)
* * * * * cd /path/to/project && php jobs.php 1>> /dev/null 2>&1
, (*6)
jobs.php
loads and runs Crony tasks, and should be referrenced from your crontab. It should include a call to the Crony::init()
method, which takes a single argument: the namespace that your tasks reside under. This namespace should be PSR-0 autoloaded by composer, and by convention should exist in the src
directory in your project's root. In the example below, all jobs are sub-directories of the src/PhilCrumm/ExampleTasks
directory and thus exist in the \PhilCrumm\ExampleTasks
namespace., (*7)
run(); ?>
Generally, Crony tasks will exist in the specified namespace, and will consist of a single PHP file (whose name matches its class) that implements the \Crony\TaskInterface
interface. It will consist of at least two functions: config()
, which returns a Jobby-formatted configuration array, and run()
, which will be ran when it's time to run the cron task., (*8)
src/PhilCrumm/ExampleTasks/SayHello.php
true, // Run every five minutes 'schedule' => '*/5 * * * *', ); } /** * This function will be ran every time the above schedule is met. * We're just printing a string to the standard output (which will be * discarded per the crontab line earlier in the readme), but generally * you'd do something a little heftier. */ public static function run() { print 'Hello, world!'; return true; } } ?>
Crony is a wrapper around Jobby, and provides all of the features included in Jobby., (*9)
Particularly, Crony suggests a convention (rather than configuration) for cron jobs., (*10)
Crony is a tool built-upon Gerard Sychay's wonderful Jobby., (*11)
PHP-based cron manager
MIT
cli cron