PHP code example of diwms / nginx-log-analyzer
1. Go to this page and download the library: Download diwms/nginx-log-analyzer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
diwms / nginx-log-analyzer example snippets
declare(strict_types=1);
use Diwms\NginxLogAnalyzer\Parse;
use Diwms\NginxLogAnalyzer\NginxAccessLogFormat;
use Diwms\NginxLogAnalyzer\RegexPattern;
$file = new SplFileObject('access.log');
$line = $file->fgets();
$parse = new Parse(new NginxAccessLogFormat(), new RegexPattern());
$information = $parse->line($line);