jkh / apache-log-parser-library
apache parser library
1.0.0
2019-05-03 20:59 UTC
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2025-06-04 10:13:07 UTC
README
Install
Using composer:
composer require jkh/apache-log-parser-library
Usage
Simply instantiate the class :
$parser = new \jkh\ApacheLogParser\ApacheLogParser();
And then parse the lines of your access log file :
$log_file = '/var/log/apache2/access.log'; $handle = fopen($log_file, "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $entry = $parser->parse($line); } fclose($handle); } else { echo "An error occurred: unable to open the file!\n"; }
Where $entry
object will hold all data parsed.