patchlevel / worker
Gives the opportunity to build a stable worker that terminates properly when limits are exceeded.
1.7.0
2026-10-05 07:23 UTC
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
- psr/clock: ^1.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- symfony/event-dispatcher: ^5.4.26 || ^6.4.0 || ^7.0.0 || ^8.0.0
Requires (Dev)
- infection/infection: ^0.32.0
- patchlevel/coding-standard: ^1.3.0
- phpat/phpat: ^0.12.0
- phpbench/phpbench: ^1.2.15
- phpstan/phpstan: ^2.1.32
- phpstan/phpstan-phpunit: ^2.0.8
- phpunit/phpunit: ^11.5.3
- symfony/var-dumper: ^5.4.29 || ^6.4.0 || ^7.0.0 || ^8.0.0
- wnx/commonmark-markdown-renderer: ^1.6
Suggests
- ext-pcntl: Required to stop the worker gracefully on SIGTERM
Provides
None
Conflicts
None
Replaces
None
README
Worker
A small library to build stable, long-running workers that terminate gracefully when limits are exceeded or a SIGTERM/SIGINT signal is received. Perfect for daemonized console commands running under Docker, Kubernetes, supervisor or systemd, where the process manager restarts the worker after it exits.
Features
- Configurable run, memory and time limits
- Graceful shutdown on SIGTERM and SIGINT
- Extensible via events and custom listeners
- PSR-3 logging of the worker lifecycle
- Plays well with Symfony and Laravel console commands
Installation
composer require patchlevel/worker
Documentation
- Documentation
- Related Blog