{"id":13623630,"url":"https://github.com/mtdowling/cron-expression","last_synced_at":"2026-10-19T00:07:22.919Z","repository":{"id":40414471,"uuid":"1641123","full_name":"mtdowling/cron-expression","owner":"mtdowling","description":"CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due","archived":false,"fork":false,"pushed_at":"2024-04-19T17:16:35.000Z","size":200,"stargazers_count":4859,"open_issues_count":11,"forks_count":340,"subscribers_count":68,"default_branch":"master","last_synced_at":"2026-10-07T13:23:40.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/","language":"PHP","has_issues":true,"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/mtdowling.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-04-20T15:48:27.000Z","updated_at":"2026-09-24T13:26:54.000Z","dependencies_parsed_at":"2022-07-14T00:50:41.292Z","dependency_job_id":"10939eb8-16ec-4713-9dbb-f1fb11944a07","html_url":"https://github.com/mtdowling/cron-expression","commit_stats":{"total_commits":153,"total_committers":41,"mean_commits":3.731707317073171,"dds":0.6993464052287581,"last_synced_commit":"d060aaded455d9eba498553f0566309867686144"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mtdowling/cron-expression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtdowling%2Fcron-expression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtdowling%2Fcron-expression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtdowling%2Fcron-expression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtdowling%2Fcron-expression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtdowling","download_url":"https://codeload.github.com/mtdowling/cron-expression/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtdowling%2Fcron-expression/sbom","scorecard":{"id":666456,"data":{"date":"2025-08-11","repo":{"name":"github.com/mtdowling/cron-expression","commit":"d060aaded455d9eba498553f0566309867686144"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":4,"reason":"Found 11/24 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T18:11:20.111Z","repository_id":40414471,"created_at":"2025-08-21T18:11:20.111Z","updated_at":"2025-08-21T18:11:20.111Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344872684,"owners_count":38343427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-18T02:00:06.448Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T21:01:33.977Z","updated_at":"2026-10-19T00:07:22.674Z","avatar_url":"https://github.com/mtdowling.png","language":"PHP","funding_links":[],"categories":["Table of Contents","命令行","PHP","目录","Command Line","命令行( Command Line )","Utilities","命令行 Command Line"],"sub_categories":["Command Line","命令行 Command Line","Date and Time","Library"],"readme":"PHP Cron Expression Parser\n==========================\n\n[![Latest Stable Version](https://poser.pugx.org/mtdowling/cron-expression/v/stable.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Total Downloads](https://poser.pugx.org/mtdowling/cron-expression/downloads.png)](https://packagist.org/packages/mtdowling/cron-expression) [![Build Status](https://secure.travis-ci.org/mtdowling/cron-expression.png)](http://travis-ci.org/mtdowling/cron-expression)\n\n**NOTE** This fork has been deprecated and development moved to [https://github.com/dragonmantank/cron-expression](https://github.com/dragonmantank/cron-expression). More information can be found in the blog post [here](http://ctankersley.com/2017/10/12/cron-expression-update/). tl;dr - v2.0.0 is a major breaking change, and @dragonmantank can better take care of the project in a separate fork. \n\nThe PHP cron expression parser can parse a CRON expression, determine if it is\ndue to run, calculate the next run date of the expression, and calculate the previous\nrun date of the expression.  You can calculate dates far into the future or past by\nskipping n number of matching dates.\n\nThe parser can handle increments of ranges (e.g. */12, 2-59/3), intervals (e.g. 0-9),\nlists (e.g. 1,2,3), W to find the nearest weekday for a given day of the month, L to\nfind the last day of the month, L to find the last given weekday of a month, and hash\n(#) to find the nth weekday of a given month.\n\nInstalling\n==========\n\nAdd the dependency to your project:\n\n```bash\ncomposer require mtdowling/cron-expression\n```\n\nUsage\n=====\n```php\n\u003c?php\n\nrequire_once '/vendor/autoload.php';\n\n// Works with predefined scheduling definitions\n$cron = Cron\\CronExpression::factory('@daily');\n$cron-\u003eisDue();\necho $cron-\u003egetNextRunDate()-\u003eformat('Y-m-d H:i:s');\necho $cron-\u003egetPreviousRunDate()-\u003eformat('Y-m-d H:i:s');\n\n// Works with complex expressions\n$cron = Cron\\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5');\necho $cron-\u003egetNextRunDate()-\u003eformat('Y-m-d H:i:s');\n\n// Calculate a run date two iterations into the future\n$cron = Cron\\CronExpression::factory('@daily');\necho $cron-\u003egetNextRunDate(null, 2)-\u003eformat('Y-m-d H:i:s');\n\n// Calculate a run date relative to a specific time\n$cron = Cron\\CronExpression::factory('@monthly');\necho $cron-\u003egetNextRunDate('2010-01-12 00:00:00')-\u003eformat('Y-m-d H:i:s');\n```\n\nCRON Expressions\n================\n\nA CRON expression is a string representing the schedule for a particular command to execute.  The parts of a CRON schedule are as follows:\n\n    *    *    *    *    *\n    -    -    -    -    -\n    |    |    |    |    |\n    |    |    |    |    |\n    |    |    |    |    +----- day of week (0 - 7) (Sunday=0 or 7)\n    |    |    |    +---------- month (1 - 12)\n    |    |    +--------------- day of month (1 - 31)\n    |    +-------------------- hour (0 - 23)\n    +------------------------- min (0 - 59)\n\nRequirements\n============\n\n- PHP 7.0+\n- PHPUnit is required to run the unit tests\n- Composer is required to run the unit tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtdowling%2Fcron-expression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtdowling%2Fcron-expression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtdowling%2Fcron-expression/lists"}