https://github.com/touchdesign/logrotate
Rotate log files.
https://github.com/touchdesign/logrotate
archive filesystem linux-like log logrotate php unix-like
Last synced: 5 months ago
JSON representation
Rotate log files.
- Host: GitHub
- URL: https://github.com/touchdesign/logrotate
- Owner: touchdesign
- Created: 2020-10-15T16:17:19.000Z (over 5 years ago)
- Default Branch: develop
- Last Pushed: 2021-01-08T17:19:55.000Z (over 5 years ago)
- Last Synced: 2025-12-21T00:35:08.012Z (6 months ago)
- Topics: archive, filesystem, linux-like, log, logrotate, php, unix-like
- Language: PHP
- Homepage:
- Size: 110 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://php.net/)
# 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
```shell
composer require touchdesign/logrotate
```
## Usage
```php
$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.