Skip to content

oudirichi/scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scheduler - whenever gem alternative for PHP

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)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages