Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

shuipf/cron

Repository files navigation

PHP Cron Expression Parser

Build Status Code Coverage License Latest Stable Version Total Downloads

Standard (V7) compliant crontab expression parser/validator with support for time zones; see "man 5 crontab" for possible expressions.

Installation

Using composer, add a requirement for poliander/cron to your composer.json file:

composer require poliander/cron

Examples

Validate a certain crontab expression:

$expression = new \Cron\CronExpression('15,45 */2 * * *');
$isValid = $expression->isValid(); // returns true

Check whether a given point in time is matching a certain cron expression:

$expression = new \Cron\CronExpression('45 9 * * *');
$dt = new \DateTime('2014年05月18日 09:45');
$isMatching = $expression->isMatching($dt); // returns true

Match an expression across different time zones:

$expression = new \Cron\CronExpression('45 9 * * *', new DateTimeZone('Europe/Berlin'));
$dt = new \DateTime('2014年05月18日 08:45', new DateTimeZone('Europe/London'));
$isMatching = $expression->isMatching($dt); // returns true

Calculate next timestamp matching a Friday, the 13th:

$expression = new \Cron\CronExpression('* * 13 * fri');
$when = $expression->getNext();

Changelog

version release notes
1.0.0 (2015年06月20日) initial release
1.1.0 (2016年06月11日) dropped PHP 5.4 support
1.2.0 (2016年12月11日) added PHP 7.1 support
1.2.1 (2017年05月25日) (削除) fixed #3 (削除ここまで)
1.2.2 (2017年06月03日) fixed #3, #4
2.0.0 (2017年11月30日) dropped PHP 5.x, added PHP 7.2 support, added vendor namespace (closes #2)
master updated PHPUnit dependency to 6.*

About

Parse and validate crontab expressions in PHP

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

  • PHP 100.0%

AltStyle によって変換されたページ (->オリジナル) /