jpi/cron-linter

Cron Linting

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

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 .cronlinter.yml file to your project root, that provides a list of files to be linted.

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

Then run php vendor/bin/lintcron, it should then list any errors found in the specified cron files. You can have different config file location using the --config 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.

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

// $expression is a string containing the cron expression(s)
$errors = \JPI\CronLinter::lintContent($expression);

// Both return an array of errors found, 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 General Public Licence - see the licence file for details