PHPackages                             tm/error-log-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. tm/error-log-parser

AbandonedArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

tm/error-log-parser
===================

PHP error\_log parser library.

1.2.1(8y ago)23145.9k↓22.1%7[1 issues](https://github.com/tommy-muehle/error-log-parser/issues)MITPHPPHP &gt;=5.6.0

Since Jan 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/tommy-muehle/error-log-parser)[ Packagist](https://packagist.org/packages/tm/error-log-parser)[ Docs](https://github.com/tommy-muehle/error-log-parser)[ RSS](/packages/tm-error-log-parser/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

error-log-parser
================

[](#error-log-parser)

[![Build Status](https://camo.githubusercontent.com/49b9f09b058f997c5d6664b0939a0865d8aa3667d5704c22878e5b618b25da77/68747470733a2f2f7472617669732d63692e6f72672f746f6d6d792d6d7565686c652f6572726f722d6c6f672d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tommy-muehle/error-log-parser)[![Minimum PHP Version](https://camo.githubusercontent.com/0aa7445f06e06d72b9552b4ace117e3765a60fa64d6c973cac177557fd20368f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e352d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/tommy-muehle/error-log-parser/master/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/5364cd0663a8038c657bd651502233376c0850c638eb7a9ffd20b5c5fa813660/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f746f6d6d792d6d7565686c652f6572726f722d6c6f672d7061727365722e737667)](https://github.com/tommy-muehle/error-log-parser/issues)

Simple PHP library to parse Apache or Nginx error-log file entries for further usage.

Install
-------

[](#install)

Using [Composer](https://getcomposer.org/)

```
$ composer require tm/error-log-parser

```

or manually add this to composer.json

```
{
    "require": {
        "tm/error-log-parser": "~1.1"
    }
}

```

Usage
-----

[](#usage)

Instantiate the class:

```
use TM\ErrorLogParser\Parser;
$parser = new Parser(Parser::TYPE_APACHE) // or TYPE_NGINX;

```

And then parse the lines:

```
function getLines($file)
 {
    $f = fopen($file, 'r');
    if (!$f) throw new Exception();
    while ($line = fgets($f)) {
        yield $line;
    }
    fclose($f);
}

foreach (getLines('/var/log/apache2/error.log') as $line) {
    $entry = $parser->parse($line);
}

```

Where `$entry` hold all parsed data. For Apache:

```
stdClass Object (
    [date] => "Tue Dec 29 08:14:45 2015"
    [type] => "warn"
    [client] => "193.158.15.243"
    [message] => "mod_fcgid: stderr: PHP Warning:  Division by zero in /var/www/kd/app.de/src/Calc.php on line 346, referer: https://www.app.de"
)

```

And for Nginx:

```
stdClass Object (
    [date] => "2011/06/10 13:30:10"
    [type] => "error"
    [message] => "*1 directory index of "/var/www/ssl/" is forbidden"
    [client] => "86.186.86.232"
    [server] => "hotelpublisher.com"
    [request] => "GET / HTTP/1.1"
    [host] => "hotelpublisher.com"
)

```

Otherwise you can use the FormlessParser for formless log files:

```
stdClass Object (
    [type] => "info"
    [message] => "23263#0: *1 directory index of "/var/www/ssl/" is forbidden, client: 86.186.86.232, server: hotelpublisher.com, request: "GET / HTTP/1.1", host: "hotelpublisher.com""
)

```

Contributing
------------

[](#contributing)

Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 89.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~166 days

Total

5

Last Release

3169d ago

PHP version history (2 changes)1.0PHP &gt;=5.5.0

1.2.1PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/618c748bc15b0e91e6280fcf687e28c1afaeb36335d634372d85f7eba3f0cf4f?d=identicon)[tommymuehle](/maintainers/tommymuehle)

---

Top Contributors

[![tommy-muehle](https://avatars.githubusercontent.com/u/1351840?v=4)](https://github.com/tommy-muehle "tommy-muehle (17 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![Ukrator](https://avatars.githubusercontent.com/u/5803630?v=4)](https://github.com/Ukrator "Ukrator (1 commits)")

---

Tags

apacheerror-logformlessnginxparserphplogparsererrornginxapacheerror\_log

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tm-error-log-parser/health.svg)

```
[![Health](https://phpackages.com/badges/tm-error-log-parser/health.svg)](https://phpackages.com/packages/tm-error-log-parser)
```

###  Alternatives

[kassner/log-parser

PHP Log Parser Library

344455.6k6](/packages/kassner-log-parser)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3511.6M24](/packages/analog-analog)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

299582.7k1](/packages/larabug-larabug)[saasscaleup/laravel-log-alarm

Laravel log Alarm help you to set up alarm when errors occur in your system and send you a notification via Slack and email

26929.6k](/packages/saasscaleup-laravel-log-alarm)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14845.8k1](/packages/guanguans-laravel-exception-notify)[benmorel/apache-log-parser

PHP library to parse Apache log files

268.6k](/packages/benmorel-apache-log-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
