cesargb/php-log-rotation
A framework-agnostic PHP library for rotating log files by size or time, with automatic gzip/bzip2 compression, retention limits, and cleanup of old logs. Works standalone or with Laravel, PSR-3 loggers, and custom handlers.
logrotate.daily/weekly channels; per-tenant or per-job log files; worker/cron logs; local development and QA environments; packaging PHP apps where host configuration is not guaranteed.Consider it when:
logrotate, container sidecars, or platform log lifecycle rules.Look elsewhere when:
RotatingFileHandler, Laravel’s daily/weekly logging, or a centralized logging stack with retention policies.logrotate, platform agents, or logging infrastructure.For executives: This is a small, low-cost utility that helps prevent unbounded log growth and disk exhaustion in PHP/Laravel deployments, particularly self-hosted and on-prem environments. It supports retention and operational hygiene without a custom-build project. It is not strategic infrastructure, but it is a pragmatic build-vs-buy shortcut with low licensing friction (MIT). Approve a limited evaluation, not a platform commitment.
For engineering: Evaluate cesargb/php-log-rotation as a focused dependency for rotating logs that fall outside Monolog/Laravel channels or host-level logrotate. Confirm file-locking behavior, compression support, retention semantics, PHP version compatibility, and test coverage before adoption. If adopted, wrap it behind an internal logging/retention interface, add integration tests for concurrent writes and cleanup, and keep a fork/vendor fallback because adoption is low. Do not use it to replace centralized logging or OS-level rotation where those are available.
How can I help you explore Laravel packages today?