2017 © Pedro Peláez
 

library easy-crontab

Object oriented API for reading and writing crontab

image

taueres/easy-crontab

Object oriented API for reading and writing crontab

  • Sunday, September 27, 2015
  • by taueres
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

EasyCrontab

Object oriented API for reading and writing to/from crontab., (*1)

Build Status, (*2)

Installing

Via Composer

composer require taueres/easy-crontab

Otherwise manually

Clone git repository., (*3)

git clone https://github.com/taueres/easy-crontab.git ./vendor/easy-crontab

Add the following PSR-4 rules to your autoload system., (*4)

"psr-4": {
    "EasyCrontab\\": "vendor/easy-crontab/src/EasyCrontab",
    "EasyCrontab\\Test\\": "vendor/easy-crontab/test"
}

Install EasyCrontab dependencies., (*5)

"require": {
    "symfony/process": "^2.7",
    "symfony/dependency-injection": "^2.7",
    "symfony/config": "^2.7"
}

Examples

EasyCrontab is very easy to grasp., (*6)

The following examples will cover common use cases of EasyCrontab., (*7)

$crontab = EasyCrontab\CrontabFactory::getCrontab();
$jobs = $crontab->getJobs();
echo $jobs[0]->getCommand();

Add a new job to crontab

$job = new EasyCrontab\Job();
$job->setMinute('*/5');
$job->setHour('5');
$job->setDayOfMonth('*');
$job->setMonth('*');
$job->setDayOfWeek('*');
$job->setCommand('php --version');

$crontab = EasyCrontab\CrontabFactory::getCrontab();
$crontab->addJob($job);
$crontab->save();

Edit job info

$crontab = EasyCrontab\CrontabFactory::getCrontab();
$jobs = $crontab->getJobs();
$jobs[0]->setDayOfWeek('3');
$crontab->save();

Remove job from crontab

$crontab = EasyCrontab\CrontabFactory::getCrontab();
$jobs = $crontab->getJobs();
$crontab->removeJob($jobs[0]);
$crontab->save();

The Versions

27/09 2015

dev-master

9999999-dev

Object oriented API for reading and writing crontab

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

by Sergio Santoro

25/09 2015

dev-feature_dependency_injection

dev-feature_dependency_injection

Object oriented API for reading and writing crontab

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

by Sergio Santoro