{"id":19451687,"url":"https://github.com/akki-io/cron-expression-generator","last_synced_at":"2026-04-18T10:32:19.791Z","repository":{"id":50923527,"uuid":"371128023","full_name":"akki-io/cron-expression-generator","owner":"akki-io","description":"Generate cron expressions based on user inputs.","archived":false,"fork":false,"pushed_at":"2021-05-27T14:59:02.000Z","size":157,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-25T15:01:53.409Z","etag":null,"topics":["composer","cron","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akki-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-26T18:08:50.000Z","updated_at":"2024-04-25T15:01:53.409Z","dependencies_parsed_at":"2022-08-25T10:51:27.388Z","dependency_job_id":null,"html_url":"https://github.com/akki-io/cron-expression-generator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akki-io%2Fcron-expression-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akki-io%2Fcron-expression-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akki-io%2Fcron-expression-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akki-io%2Fcron-expression-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akki-io","download_url":"https://codeload.github.com/akki-io/cron-expression-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240639179,"owners_count":19833434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","cron","php"],"created_at":"2024-11-10T16:42:40.837Z","updated_at":"2025-11-19T10:03:12.841Z","avatar_url":"https://github.com/akki-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/akki-io/cron-expression-generator/master/hero.png\" alt=\"Hero\" width=\"600\"\u003e\n\u003c/p\u003e\n\n# Cron Expression Generator\n\n[![Latest Version](https://img.shields.io/github/release/akki-io/cron-expression-generator.svg?style=flat-square)](https://github.com/akki-io/cron-expression-generator/releases)\n[![Build Status](https://img.shields.io/travis/akki-io/cron-expression-generator/master.svg?style=flat-square)](https://travis-ci.com/akki-io/cron-expression-generator)\n[![Quality Score](https://img.shields.io/scrutinizer/g/akki-io/cron-expression-generator.svg?style=flat-square)](https://scrutinizer-ci.com/g/akki-io/cron-expression-generator)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![StyleCI](https://styleci.io/repos/371128023/shield?branch=master)](https://styleci.io/repos/371128023)\n[![Total Downloads](https://img.shields.io/packagist/dt/akki-io/cron-expression-generator.svg?style=flat-square)](https://packagist.org/packages/akki-io/cron-expression-generator)\n\nGenerate cron expressions based on user inputs. \n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require akki-io/cron-expression-generator\n```\n\n## Introduction\n\nA CRON expression is a string representing the schedule for a particular command to execute. \nThe parts of a CRON schedule are as follows:\n\n```shell\n*    *    *    *    *\n-    -    -    -    -\n|    |    |    |    |\n|    |    |    |    |\n|    |    |    |    +----- day of week (0 - 6) (Sunday=0)\n|    |    |    +---------- month (1 - 12)\n|    |    +--------------- day of month (1 - 31)\n|    +-------------------- hour (0 - 23)\n+------------------------- min (0 - 59)\n```\n\n| Cron Schedule | Package Request Mapping |\n| ----------- | ----------- |\n| min | minute |\n| hour | hour |\n| day of month | day_month |\n| month | month |\n| day of week | day_week |\n\n\nThis package supports the following different options for each schedule. \n\n| Option Type (*required) | Description | Nested Required Parameters |\n| ----------- | ----------- | ----------- |\n| ONCE | Generate cron once | int `at`, b/t the range of schedule |\n| EVERY | Generate cron for every | int `every`, b/t the range of schedule |\n| LIST | Generate cron based on the list of values | array `list` and int `list.*`, b/t the range of schedule |\n| RANGE | Generate cron based on range | int `start` and int `end` both b/t the range of schedule |\n| STEP | Generate cron based on step | int `every`, int `start` and int `end` all b/t the range of schedule |\n\n\n## Usage\n\nYou can set the `$options` array below based on the different options as outlined above.\n\n```php\n    use AkkiIo\\CronExpressionGenerator\\CronExpressionGenerator;\n\n    $options = [];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n```\n\n## Examples\n\n**Generate cron expression for every minute**\n\n```php\n    $options = [];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n      \n    // * * * * *\n```\n\n**Generate cron expression for once every hour**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 0,\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'EVERY',\n            'every' =\u003e 1,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n    \n    // 0 */1 * * *\n```\n\n**Generate cron expression for once every day at 10:15 AM**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 15,\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n    \n    // 15 10 * * *\n```\n\n**Generate cron expression for once every weekday at 10:15 AM**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 15,\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n        'day_week' =\u003e [\n            'type' =\u003e 'RANGE',\n            'start' =\u003e 1,\n            'end' =\u003e 5,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n    \n    // 15 10 * * 1-5\n```\n\n**Generate cron expression for once every month of day 22 at 10:15 AM**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 15,\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n        'day_month' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 22,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n      \n    // 15 10 22 * *\n```\n\n**Generate cron expression for every Sunday at 10:15 AM**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 15,\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n        'day_week' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 0,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n      \n    // 15 10 * * 0\n```\n\n**Generate cron expression for every year on Oct 22 at 10:15 AM**\n\n```php\n    $options = [\n        'minute' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 15\n        ],\n        'hour' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n        'day_month' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 22,\n        ],\n        'month' =\u003e [\n            'type' =\u003e 'ONCE',\n            'at' =\u003e 10,\n        ],\n    ];\n\n    $cronExpression = (new CronExpressionGenerator($options))-\u003egenerate();\n      \n    // 15 10 22 10 *\n```\n\n### Testing\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email hello@akki.io instead of using the issue tracker.\n\n## Credits\n\n-   [Akki Khare](https://github.com/akki-io)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakki-io%2Fcron-expression-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakki-io%2Fcron-expression-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakki-io%2Fcron-expression-generator/lists"}