PHPackages                             dfun90/cron-expression - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dfun90/cron-expression

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dfun90/cron-expression
======================

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due

v3.3.2(3y ago)06MITPHPPHP ^7.2|^8.0

Since Jul 15Pushed 3y agoCompare

[ Source](https://github.com/dfun90/cron-expression)[ Packagist](https://packagist.org/packages/dfun90/cron-expression)[ GitHub Sponsors](https://github.com/dragonmantank)[ RSS](/packages/dfun90-cron-expression/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (5)Versions (31)Used By (0)

PHP Cron Expression Parser
==========================

[](#php-cron-expression-parser)

[![Latest Stable Version](https://camo.githubusercontent.com/4c05cb1c90f6d680c60aa2920cca054c41964fe9259177a4851cae21ea203015/68747470733a2f2f706f7365722e707567782e6f72672f647261676f6e6d616e74616e6b2f63726f6e2d65787072657373696f6e2f762f737461626c652e706e67)](https://packagist.org/packages/dragonmantank/cron-expression) [![Total Downloads](https://camo.githubusercontent.com/5206646415c9d1970991cfc983f3ece05558a00a12744c350b57e63d2f9ea0d4/68747470733a2f2f706f7365722e707567782e6f72672f647261676f6e6d616e74616e6b2f63726f6e2d65787072657373696f6e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/dragonmantank/cron-expression) [![Build Status](https://camo.githubusercontent.com/597ee535ab292593a7ffcc2eac1594ba045abe33b740bba4d3172ca7efeaa217/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f647261676f6e6d616e74616e6b2f63726f6e2d65787072657373696f6e2e706e67)](http://travis-ci.org/dragonmantank/cron-expression) [![StyleCI](https://camo.githubusercontent.com/a8347c6b2aceb5a6ee3cf967056c82544b672e51eb9d2d27557557004546da5b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3130333731353333372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/103715337)

The PHP cron expression parser can parse a CRON expression, determine if it is due to run, calculate the next run date of the expression, and calculate the previous run date of the expression. You can calculate dates far into the future or past by skipping **n** number of matching dates.

The parser can handle increments of ranges (e.g. \*/12, 2-59/3), intervals (e.g. 0-9), lists (e.g. 1,2,3), **W** to find the nearest weekday for a given day of the month, **L** to find the last day of the month, **L** to find the last given weekday of a month, and hash (#) to find the nth weekday of a given month.

More information about this fork can be found in the blog post [here](http://ctankersley.com/2017/10/12/cron-expression-update/). tl;dr - v2.0.0 is a major breaking change, and @dragonmantank can better take care of the project in a separate fork.

Installing
==========

[](#installing)

Add the dependency to your project:

```
composer require dragonmantank/cron-expression
```

Usage
=====

[](#usage)

```
