filippo-toso / php-supervisor
A simple supervisor class that allows to run long lived PHP scripts from the crontab
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/filippo-toso/php-supervisor
Requires
- php: ^7.2 || ^8.0
This package is auto-updated.
Last update: 2025-09-19 18:54:14 UTC
README
A simple supervisor tool that allows to run PHP long running scripts through crontab.
Requirements
- PHP 5.6+
Installing
Use Composer to install it:
composer require filippo-toso/php-supervisor
Using It
Create a simple PHP script with a code like the following:
use FilippoToso\PhpSupervisor\Supervisor;
Supervisor::run(function() {
// Do your long lived stuff here
}, __DIR__ . '/lock.dat', __DIR__ . '/stop.dat');
Then call the script every minute from the crontab. The code in the closure will be kept running untill the $stopFile specified in the third parameter exists (stop.dat
in the example).