jimenezmaximiliano / php-tail-file
This package is abandoned and no longer maintained.
No replacement package was suggested.
Efficiently reads the last lines of a file like the tail command
Package info
github.com/jimenezmaximiliano/php-tail-file
pkg:composer/jimenezmaximiliano/php-tail-file
1.1.6
2023-01-18 21:09 UTC
Requires
- php: >=7.4
Requires (Dev)
- ext-dom: *
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-04-19 20:57:07 UTC
README
Efficiently tail a file from PHP - Reads the last x number of lines of a file (similar to Unix's tail command)
- Great performance
- It doesn't load the whole file to memory
- Skips trailing new lines and empty lines
- No dependencies
- Tested on Linux, Windows and macOS
- Compatible with PHP 7.4 and ^8
Usually used to read the last lines of:
- CSV files
- Log files
- JSON files
- text files
Installation
composer require jimenezmaximiliano/php-tail-file
Usage
$numberOfLines = 2; $filePath = realpath("file.log"); $lines = Tail::tail($filePath, $numberOfLines); // ["line 30", "line 31"]