phpgt/cron

There is no license information available for the latest version (v1.0.4) of this package.

Run scripts or static functions at regular intervals.

Maintainers

Package info

github.com/PhpGt/Cron

Issues

pkg:composer/phpgt/cron

Fund package maintenance!

PhpGt

Statistics

Installs: 3 365

Dependents: 4

Suggesters: 0

Stars: 2

v1.0.4 2025-03-07 18:07 UTC

README

Define background jobs in standard crontab format and the Cron Runner will execute them when they are due. Jobs can be either normal scripts, or calls to static functions with automatic autoloading taken care of.

Build status Code quality Code coverage Current version PHP.Gt/Cron documentation

Example usage

crontab file within your project directory:

00 * * * *	ExampleClass::hourlyTask()
0 22 * * 1-5	YourApp\Accounts\Daily::nightRoutine("you can pass properties too!")
# This is a comment. The above job will run at 10pm Mon-Fri.
*/10 * * * *	ExampleClass::runEveryTenMinutes

Start the Runner: vendor/bin/cron.

If you're using WebEngine, the Cron Runner is automatically started for you by running gt run.

Examples

There is an example directory with numbered scripts that can be run directly with php. Each one embeds its own crontab string so the schedule and output stay together.

Proudly sponsored by

JetBrains Open Source sponsorship program

JetBrains logo.