PHPackages                             innmind/log-reader - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. innmind/log-reader

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

innmind/log-reader
==================

Parse log files

6.0.0(4mo ago)35941MITPHPPHP ~8.4CI passing

Since May 27Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Innmind/LogReader)[ Packagist](https://packagist.org/packages/innmind/log-reader)[ Docs](http://github.com/Innmind/LogReader)[ RSS](/packages/innmind-log-reader/feed)WikiDiscussions develop Synced 2w ago

READMEChangelog (5)Dependencies (5)Versions (16)Used By (1)

Log reader
==========

[](#log-reader)

[![CI](https://github.com/Innmind/LogReader/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/LogReader/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/3c6e2a8a7650e3fa9e5bf9b7fd39f5d488c8a5bed60c8e03b6cdd0d83f16ef0c/68747470733a2f2f636f6465636f762e696f2f67682f496e6e6d696e642f4c6f675265616465722f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/Innmind/LogReader)[![Type Coverage](https://camo.githubusercontent.com/d23058d4e3c6b4bd1a51dcc4363c60ad4dea2f5d22e87f46586b81855d356c98/68747470733a2f2f73686570686572642e6465762f6769746875622f496e6e6d696e642f4c6f675265616465722f636f7665726167652e737667)](https://shepherd.dev/github/Innmind/LogReader)

Allow you to parse symfony and apache access logs.

**BEWARE, it can take a lot of time depending on the amount of data** (For a typical symfony `dev.log` it starts to really slow down after 10k lines)

Installation
------------

[](#installation)

```
composer require innmind/log-reader
```

Usage
-----

[](#usage)

```
use Innmind\LogReader\{
    Reader,
    LineParser\Monolog,
    Log,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Filesystem\Name;
use Innmind\Url\Path;
use Psr\Log\LogLevel;

$os = Factory::build();

$read = Reader::of(
    Monolog::of($os->clock()),
);
$os
    ->filesystem()
    ->mount(Path::of('var/logs/'))
    ->get(Name::of('prod.log'))
    ->map(static fn($file) => $file->content())
    ->map($read)
    ->map(
        static fn($logs) => $logs
            ->filter(
                static fn($log) => $log
                    ->attribute('level')
                    ->filter(static fn($level) => $level->value() === LogLevel::CRITICAL)
                    ->match(
                        static fn() => true,
                        static fn() => false,
                    ),
            )
            ->foreach(
                static fn($log) => $log
                    ->attribute('message')
                    ->match(
                        static fn($attribute) => print($attribute->value()),
                        static fn() => print('No message found'),
                    ),
            ),
        static fn() => print('File does not exist'),
    );
```

The above example will print all messages that were logged at a critical level.

Note

If parsing the `context` or `extra` attributes of a monolog line fail they won't be exposed as attributes in the `Log` object. This behaviour is implemented to not make the whole parsing fail due to this error.

Note

If a line can't be parsed for some reason it will simply be ignored and not exposed. Again this behaviour is implemented to not make the whole parsing fail.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~289 days

Recently: every ~278 days

Total

12

Last Release

135d ago

Major Versions

1.0.0 → 2.0.02017-10-07

2.0.1 → 3.0.02018-12-01

3.0.0 → 4.0.02020-02-05

4.1.0 → 5.0.02023-01-08

5.4.0 → 6.0.02026-02-15

PHP version history (7 changes)1.0.0PHP ~7.1

3.0.0PHP ~7.2

4.0.0PHP ~7.4

4.1.0PHP ~7.4|~8.0

5.0.0PHP ~8.1

5.3.0PHP ~8.2

6.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (125 commits)")

### Embed Badge

![Health badge](/badges/innmind-log-reader/health.svg)

```
[![Health](https://phpackages.com/badges/innmind-log-reader/health.svg)](https://phpackages.com/packages/innmind-log-reader)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.1k](/packages/symfony-cache)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

186557.3k2](/packages/wikimedia-parsoid)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M148](/packages/algolia-algoliasearch-client-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)

PHPackages © 2026

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