Skip to content

pavlenko/php-component-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cron component

Installation

php composer.phar require pe/component-cron:^1.0

Usage

use PE\Component\Cron\Crontab;
use PE\Component\Cron\Job;

// Instantiate with default binary path
$crontab = new Crontab();

// Or instantiate with custom binary path
$crontab = new Crontab('/usr/sbin/crontab');

// Get all jobs
$crontab->all();// returns array of Job instances

// Create new job from string
$job = Job::fromString('*/5 * * * * command');

// Or create programmatically
$job = (new Job())->setMinute('*/5')->setCommand('command');

// Add job
$crontab->add($job);

// Get job by index
$job = $crontab->get(0);

// Remove job by index
$crontab->remove(0);

About

Crontab manipulation library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages