taueres/easy-crontab 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

taueres/easy-crontab

Composer 安装命令:

composer require taueres/easy-crontab

包简介

Object oriented API for reading and writing crontab

README 文档

README

Object oriented API for reading and writing to/from crontab.

Build Status

Installing

Via Composer

composer require taueres/easy-crontab

Otherwise manually

Clone git repository.

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

Add the following PSR-4 rules to your autoload system.

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

Install EasyCrontab dependencies.

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

Examples

EasyCrontab is very easy to grasp.

The following examples will cover common use cases of EasyCrontab.

Print command of the first job registered

$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();

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-06-13