PHPackages                             enterdev/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. enterdev/cron-expression

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

enterdev/cron-expression
========================

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

1.2.0(9y ago)14.3k↓46.5%1MITPHPPHP &gt;=5.3.2

Since Jul 15Pushed 9y ago2 watchersCompare

[ Source](https://github.com/enterdev/cron-expression)[ Packagist](https://packagist.org/packages/enterdev/cron-expression)[ RSS](/packages/enterdev-cron-expression/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (8)Used By (1)

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

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

This is a fork of a cron-expression library by Michael Dowling (mtdowling). The main difference between this one and the original, is that this fork adds support for seconds (which makes it noticeably slower, so I urge you to use the original if you don't need seconds).

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.

Installing
==========

[](#installing)

Add the dependency to your project:

```
composer require enterdev/cron-expression
```

Usage
=====

[](#usage)

```
