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

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

philiprehberger/cron-expression-builder
=======================================

Fluent cron expression builder with human-readable methods

v1.0.2(4d ago)11MITPHPPHP ^8.2CI passing

Since Mar 13Pushed yesterdayCompare

[ Source](https://github.com/philiprehberger/cron-expression-builder)[ Packagist](https://packagist.org/packages/philiprehberger/cron-expression-builder)[ Docs](https://github.com/philiprehberger/cron-expression-builder)[ RSS](/packages/philiprehberger-cron-expression-builder/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (4)Used By (0)

PHP Cron Expression Builder
===========================

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

[![Tests](https://github.com/philiprehberger/cron-expression-builder/actions/workflows/tests.yml/badge.svg)](https://github.com/philiprehberger/cron-expression-builder/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/18f4f0869571dda1e12c50871babd541bc2741c0a7fa57988a21c80e8ebc7a2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068696c69707265686265726765722f63726f6e2d65787072657373696f6e2d6275696c6465722e737667)](https://packagist.org/packages/philiprehberger/cron-expression-builder)[![License](https://camo.githubusercontent.com/d24e958d83cbf223112cf226db46647cd85b1c3d8d1e426e68efd2c8c0acfbf5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068696c69707265686265726765722f63726f6e2d65787072657373696f6e2d6275696c646572)](LICENSE)

Fluent cron expression builder with human-readable methods.

Requirements
------------

[](#requirements)

- PHP 8.2+

Installation
------------

[](#installation)

```
composer require philiprehberger/cron-expression-builder
```

Usage
-----

[](#usage)

### Static Shortcuts

[](#static-shortcuts)

Use the `Cron` class for common schedules:

```
use PhilipRehberger\CronBuilder\Cron;

Cron::everyMinute();          // * * * * *
Cron::everyFiveMinutes();     // */5 * * * *
Cron::everyTenMinutes();      // */10 * * * *
Cron::everyFifteenMinutes();  // */15 * * * *
Cron::everyThirtyMinutes();   // */30 * * * *
Cron::hourly();               // 0 * * * *
Cron::hourlyAt(30);           // 30 * * * *
Cron::daily();                // 0 0 * * *
Cron::dailyAt('14:30');       // 30 14 * * *
Cron::weekly();               // 0 0 * * 0
Cron::weeklyOn(1, '09:00');   // 0 9 * * 1
Cron::monthly();              // 0 0 1 * *
Cron::monthlyOn(15, '08:00'); // 0 8 15 * *
Cron::yearly();               // 0 0 1 1 *
```

### Custom Builder

[](#custom-builder)

Build complex expressions with the fluent builder:

```
use PhilipRehberger\CronBuilder\Cron;

$expression = Cron::custom()
    ->minute('*/10')
    ->hour('9-17')
    ->dayOfWeek('1-5')
    ->build();

// */10 9-17 * * 1-5
```

The builder implements `Stringable`, so you can use it directly in string contexts:

```
echo Cron::custom()->minute('0')->hour('*/2'); // 0 */2 * * *
```

### Validator

[](#validator)

Validate cron expression syntax:

```
use PhilipRehberger\CronBuilder\CronValidator;

CronValidator::isValid('*/5 * * * *');   // true
CronValidator::isValid('60 * * * *');    // false
CronValidator::isValid('invalid');       // false
```

### Describer

[](#describer)

Get human-readable descriptions:

```
use PhilipRehberger\CronBuilder\CronDescriber;

CronDescriber::describe('* * * * *');      // "Every minute"
CronDescriber::describe('0 * * * *');      // "Every hour"
CronDescriber::describe('0 0 * * *');      // "Every day at midnight"
CronDescriber::describe('*/5 * * * *');    // "Every 5 minutes"
CronDescriber::describe('30 14 * * *');    // "Every day at 14:30"
CronDescriber::describe('0 0 * * 0');      // "Every Sunday at midnight"
CronDescriber::describe('0 0 1 * *');      // "First day of every month at midnight"
CronDescriber::describe('0 0 1 1 *');      // "Every year on January 1st at midnight"
```

API
---

[](#api)

MethodReturnsDescription`Cron::everyMinute()``string`Every minute (`* * * * *`)`Cron::everyFiveMinutes()``string`Every 5 minutes (`*/5 * * * *`)`Cron::everyTenMinutes()``string`Every 10 minutes (`*/10 * * * *`)`Cron::everyFifteenMinutes()``string`Every 15 minutes (`*/15 * * * *`)`Cron::everyThirtyMinutes()``string`Every 30 minutes (`*/30 * * * *`)`Cron::hourly()``string`Every hour at :00 (`0 * * * *`)`Cron::hourlyAt(int $minute)``string`Every hour at given minute`Cron::daily()``string`Every day at midnight (`0 0 * * *`)`Cron::dailyAt(string $time)``string`Every day at HH:MM`Cron::weekly()``string`Every Sunday at midnight`Cron::weeklyOn(int $day, string $time)``string`Weekly on given day at time`Cron::monthly()``string`First of month at midnight`Cron::monthlyOn(int $day, string $time)``string`Monthly on given day at time`Cron::yearly()``string`January 1st at midnight`Cron::custom()``CronBuilder`Start fluent builder`CronValidator::isValid(string $expr)``bool`Validate cron syntax`CronDescriber::describe(string $expr)``string`Human-readable descriptionDevelopment
-----------

[](#development)

```
composer install
vendor/bin/phpunit
vendor/bin/pint --test
vendor/bin/phpstan analyse
```

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

4d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfd7d24cbbf32400fa13ce0bbe7a31edd2d66a6d4488eafdb3d64c5337bf0435?d=identicon)[philiprehberger](/maintainers/philiprehberger)

---

Top Contributors

[![philiprehberger](https://avatars.githubusercontent.com/u/8218077?v=4)](https://github.com/philiprehberger "philiprehberger (9 commits)")

---

Tags

buildertimecronscheduleexpression

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/philiprehberger-cron-expression-builder/health.svg)

```
[![Health](https://phpackages.com/badges/philiprehberger-cron-expression-builder/health.svg)](https://phpackages.com/packages/philiprehberger-cron-expression-builder)
```

###  Alternatives

[dragonmantank/cron-expression

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

4.7k463.2M391](/packages/dragonmantank-cron-expression)[league/period

Time range API for PHP

7535.3M17](/packages/league-period)[lorisleiva/cron-translator

Makes CRON expressions human-readable

3128.1M25](/packages/lorisleiva-cron-translator)[florianv/business

DateTime calculations in business hours

361773.0k1](/packages/florianv-business)[symfony/scheduler

Provides scheduling through Symfony Messenger

889.9M36](/packages/symfony-scheduler)[mult1mate/cron-manager

Flexible cron tasks manager for MVC-type applications

40338.1k3](/packages/mult1mate-cron-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
