jpi/cron-linter

Tool for linting cron files and expressions

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 1

pkg:composer/jpi/cron-linter

v1.0.0 2025-12-14 19:40 UTC

This package is auto-updated.

Last update: 2025-12-31 21:14:51 UTC


README

CodeFactor Latest Stable Version Total Downloads Latest Unstable Version License GitHub last commit (branch)

Lint cron files. Based on the work of @Dave13h from https://github.com/Dave13h/php-censor-cronlint-plugin, just the PHPCensor aspect removed and made into a standalone package.

Installation

composer require --dev jpi/cron-linter

Add a .cronlinter.yml file to your project root that specifies a list of cron files to lint.

files:
  - /cron-1
  - /cron-2

Then run php vendor/bin/lintcron, which will list any errors found in the specified cron files. You can use a different config file location using the --config-file option.

You can also specify files to be linted using the --files option, providing a comma-separated list of file paths.

Or if you want to do it programmatically on files or content.

// Lint cron files
// $files is an array of file paths for cron files to check
// $baseDir (optional) is a string containing the base directory path for all file paths
$errors = \JPI\CronLinter::lintFiles($files, $baseDir);

// Lint cron content directly
// $expression is a string containing one or more cron expressions (one per line)
$errors = \JPI\CronLinter::lintContent($expression);

// Both methods return an array of error messages, or an empty array if no errors found

Support

If you found this library interesting or useful please spread the word about this library: share on your socials, star on GitHub, etc.

If you find any issues or have any feature requests, you can open a issue or email me @ jahidulpabelislam.com 😏.

Authors

Licence

This module is licenced under the GNU General Public Licence - see the licence file for details