oudirichi / scheduler
A PHP version of Whenever gem.
v1.0.0
2017-04-30 04:10 UTC
Requires
- symfony/console: ~2.3|~3.0
This package is not auto-updated.
Last update: 2025-06-18 04:48:14 UTC
README
Installation
Install the latest version for global usage with
$ composer global require oudirichi/scheduler
or per project
$ composer require oudirichi/scheduler
Getting started
$ cd /apps/my-great-project # for global $ shedulerize # for specific project $ vendor/bin/shedulerize
This will create an initial config/schedule.php
file for you.
The scheduler
command
$ cd /apps/my-great-project
$ scheduler
This will simply show you your schedule.rb file converted to cron syntax. It does not read or write your crontab file; you'll need to do this in order for your jobs to execute:
$ scheduler --update-crontab
Define your own job types
<?php Scheduler\job_type("pewpew", "cd :path && :task"); Scheduler\every("* * * * *", function($cron) { $cron->pewpew('echo "pewpew" >> log/test.log'); });
Cron format
* * * * * *
| | | | | |
| | | | | +-- Year (range: 1900-3000)
| | | | +---- Day of the Week (range: 0-6 OR 1-7, 0 and 7 both stand for Sunday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)