Popularity
1.0
Growing
Activity
0.0
Stable
9
1
4

Monthly Downloads: 2
Programming language: PHP
License: MIT License
Tags: Components     Text Processing     Nginx    
Latest version: v1.1.0

nginx-log-analyzer alternatives and similar libraries

Based on the "Text Processing" category.
Alternatively, view nginx-log-analyzer alternatives based on common mentions on social networks and blogs.

  • Morphos

    A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time intervals. / Морфологическая библиотека для английского и русского языков. Склоняет имена собственные, названия географических объектов, склонение и плюрализация имен собственных и другое.
  • language-detection

    A language detection library for PHP. Detects the language from a given text string.

Do you think we are missing an alternative of nginx-log-analyzer or a related project?

Add another 'Text Processing' Library

README

nginx-log-analyzer

Latest Version on Packagist [Software License](LICENSE) Build Status StyleCI Coverage Total Downloads


Installation

composer require diwms/nginx-log-analyzer

Usage

<?php

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);

var_dump($information):

class stdClass#16 (8) {
  public $remote_addr =>
  string(13) "182.76.202.33"
  public $remote_user =>
  string(1) "-"
  public $time_local =>
  string(26) "21/Oct/2019:06:52:00 +0000"
  public $request =>
  string(14) "GET / HTTP/1.1"
  public $status =>
  string(3) "404"
  public $bytes_sent =>
  string(3) "580"
  public $http_referer =>
  string(1) "-"
  public $http_user_agent =>
  string(110) "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
}

Configuration

Basically, Parse require two implementation:

  1. Format contract. There is getStringRepresentation() : string method.
  2. Pattern contract. There are build(Format $format) : string and getIdentifiers() : array methods.

Library already have built-in format support of default nginx access.log format which is:

$remote_addr - $remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent"

License

The MIT License (MIT). Please see [License File](LICENSE) for more information.


*Note that all licence references and agreements mentioned in the nginx-log-analyzer README section above are relevant to that project's source code only.