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

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

zgcasas/cron-expression
=======================

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

v2.0.2(1y ago)072MITPHPPHP ^7.2|^8.0

Since Jul 15Pushed 1y agoCompare

[ Source](https://github.com/zgcasas/cron-expression)[ Packagist](https://packagist.org/packages/zgcasas/cron-expression)[ RSS](/packages/zgcasas-cron-expression/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (18)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/35ef0ae8948080a9f8e148f5e2535c7d76166e88ee94f73a54484efe5e59c686/68747470733a2f2f706f7365722e707567782e6f72672f6d74646f776c696e672f63726f6e2d65787072657373696f6e2f762f737461626c652e706e67)](https://packagist.org/packages/mtdowling/cron-expression) [![Total Downloads](https://camo.githubusercontent.com/c783eeb93b572daee057a7258bc725452f7e3581c9fc7989b4f8fb2e8f63d09b/68747470733a2f2f706f7365722e707567782e6f72672f6d74646f776c696e672f63726f6e2d65787072657373696f6e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mtdowling/cron-expression) [![Build Status](https://camo.githubusercontent.com/093cdc8d636545913c076a55092311dad6082d11af8d3241ca4917bb8ed83b5c/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6d74646f776c696e672f63726f6e2d65787072657373696f6e2e706e67)](http://travis-ci.org/mtdowling/cron-expression)

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 mtdowling/cron-expression
```

Usage
=====

[](#usage)

```
