touchdesign / logrotate
Logrotate package
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
pkg:composer/touchdesign/logrotate
Requires
- php: >=7.4
- monolog/monolog: ^2.1
- symfony/filesystem: ^5.2
- symfony/finder: ^5.2
- symfony/monolog-bundle: ^3.6
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
This package is auto-updated.
Last update: 2025-10-09 04:27:14 UTC
README
Logrotate
Linux like log rotate component written in PHP. For example, if you have a
simple logfile.log you can rotate (move) it to logfile.log.1 and so on.
The source logfile will be truncated. The number of logfiles to keep can
controlled with the $keep option.
Dependencies
- PHP 7.4 or higher
Install
composer require touchdesign/logrotate
Usage
$rotate = new RotateWorker( (new LogfileLoader('/tmp/logfile.log')) ); // Note: Keep 3 logfiles archived $rotate->run(3); $purge = new PurgeWorker( (new LogfileLoader('/tmp/logfile.log')) ); $purge->run();
For more examples take a look at the example folder in this repository.