PHPackages                             akki-io/cron-expression-generator - 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. akki-io/cron-expression-generator

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

akki-io/cron-expression-generator
=================================

Create a cron expression based on user input

v1.0(4y ago)1105MITPHPPHP ^7.4|^8.0

Since May 27Pushed 4y agoCompare

[ Source](https://github.com/akki-io/cron-expression-generator)[ Packagist](https://packagist.org/packages/akki-io/cron-expression-generator)[ Docs](https://github.com/akki-io/cron-expression-generator)[ RSS](/packages/akki-io-cron-expression-generator/feed)WikiDiscussions master Synced 4w ago

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

 [![Hero](https://raw.githubusercontent.com/akki-io/cron-expression-generator/master/hero.png)](https://raw.githubusercontent.com/akki-io/cron-expression-generator/master/hero.png)

Cron Expression Generator
=========================

[](#cron-expression-generator)

[![Latest Version](https://camo.githubusercontent.com/e7c1d4797d2acb18798edf510d18fea9214d7f59cd245384ccfdbc592021942e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f616b6b692d696f2f63726f6e2d65787072657373696f6e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/akki-io/cron-expression-generator/releases)[![Build Status](https://camo.githubusercontent.com/4fdcb0046d601dc6b7e8553c97e8e1f21cd9ec480375b56f180d91213175dc85/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616b6b692d696f2f63726f6e2d65787072657373696f6e2d67656e657261746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/akki-io/cron-expression-generator)[![Quality Score](https://camo.githubusercontent.com/d3c5ab23690d5bdb374954ca6f0495463612b132996efede16bb95635c7c9ed1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616b6b692d696f2f63726f6e2d65787072657373696f6e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/akki-io/cron-expression-generator)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![StyleCI](https://camo.githubusercontent.com/3a23118a798027ae2ab7176eb18bbe3d0ac9928b501ae9be5625712473ec0a0a/68747470733a2f2f7374796c6563692e696f2f7265706f732f3337313132383032332f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/371128023)[![Total Downloads](https://camo.githubusercontent.com/d29b9ae8253470a680ea9ed00cd8390251f9682aeec79f6fd5ed970a6c5eb371/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616b6b692d696f2f63726f6e2d65787072657373696f6e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/akki-io/cron-expression-generator)

Generate cron expressions based on user inputs.

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

[](#installation)

You can install the package via composer:

```
composer require akki-io/cron-expression-generator
```

Introduction
------------

[](#introduction)

A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows:

```
*    *    *    *    *
-    -    -    -    -
|    |    |    |    |
|    |    |    |    |
|    |    |    |    +----- day of week (0 - 6) (Sunday=0)
|    |    |    +---------- month (1 - 12)
|    |    +--------------- day of month (1 - 31)
|    +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)
```

Cron SchedulePackage Request Mappingminminutehourhourday of monthday\_monthmonthmonthday of weekday\_weekThis package supports the following different options for each schedule.

Option Type (\*required)DescriptionNested Required ParametersONCEGenerate cron onceint `at`, b/t the range of scheduleEVERYGenerate cron for everyint `every`, b/t the range of scheduleLISTGenerate cron based on the list of valuesarray `list` and int `list.*`, b/t the range of scheduleRANGEGenerate cron based on rangeint `start` and int `end` both b/t the range of scheduleSTEPGenerate cron based on stepint `every`, int `start` and int `end` all b/t the range of scheduleUsage
-----

[](#usage)

You can set the `$options` array below based on the different options as outlined above.

```
    use AkkiIo\CronExpressionGenerator\CronExpressionGenerator;

    $options = [];

    $cronExpression = (new CronExpressionGenerator($options))->generate();
```

Examples
--------

[](#examples)

**Generate cron expression for every minute**

```
    $options = [];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // * * * * *
```

**Generate cron expression for once every hour**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 0,
        ],
        'hour' => [
            'type' => 'EVERY',
            'every' => 1,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 0 */1 * * *
```

**Generate cron expression for once every day at 10:15 AM**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 15,
        ],
        'hour' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 15 10 * * *
```

**Generate cron expression for once every weekday at 10:15 AM**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 15,
        ],
        'hour' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
        'day_week' => [
            'type' => 'RANGE',
            'start' => 1,
            'end' => 5,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 15 10 * * 1-5
```

**Generate cron expression for once every month of day 22 at 10:15 AM**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 15,
        ],
        'hour' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
        'day_month' => [
            'type' => 'ONCE',
            'at' => 22,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 15 10 22 * *
```

**Generate cron expression for every Sunday at 10:15 AM**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 15,
        ],
        'hour' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
        'day_week' => [
            'type' => 'ONCE',
            'at' => 0,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 15 10 * * 0
```

**Generate cron expression for every year on Oct 22 at 10:15 AM**

```
    $options = [
        'minute' => [
            'type' => 'ONCE',
            'at' => 15
        ],
        'hour' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
        'day_month' => [
            'type' => 'ONCE',
            'at' => 22,
        ],
        'month' => [
            'type' => 'ONCE',
            'at' => 10,
        ],
    ];

    $cronExpression = (new CronExpressionGenerator($options))->generate();

    // 15 10 22 10 *
```

### Testing

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Akki Khare](https://github.com/akki-io)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

1808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e14e68b3ae58f56193332356b226c47e11512dc4520ab60918a9aa1958eff252?d=identicon)[akki-io](/maintainers/akki-io)

---

Top Contributors

[![akki-io](https://avatars.githubusercontent.com/u/34255218?v=4)](https://github.com/akki-io "akki-io (12 commits)")

---

Tags

composercronphpakki-iocron-expression-generator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/akki-io-cron-expression-generator/health.svg)

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

###  Alternatives

[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[wearepixel/laravel-cart

A cart implementation for Laravel

1310.5k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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