PHPackages                             contenir/contenir-log - 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. contenir/contenir-log

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

contenir/contenir-log
=====================

Pluggable PSR-3 logger for Laminas MVC and Mezzio, with filesystem and database storage backends.

v0.1.4(1mo ago)038↓86%MITPHPPHP ^8.1 || ^8.2 || ^8.3CI failing

Since May 27Pushed 1mo agoCompare

[ Source](https://github.com/contenir/contenir-log)[ Packagist](https://packagist.org/packages/contenir/contenir-log)[ RSS](/packages/contenir-contenir-log/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

contenir/contenir-log
=====================

[](#contenircontenir-log)

A small PSR-3 logger for Laminas MVC and Mezzio with pluggable storage. Ships with **filesystem** and **database** backends; add your own by implementing `Contenir\Log\Storage\StorageInterface`.

When a `Throwable` is passed in the PSR-3 context under `exception`, its message chain and full stack trace are recorded (the `error` column / a multi-line file entry) — so a logged 500 carries everything you need to debug it.

Install
-------

[](#install)

```
composer require contenir/contenir-log
```

- **Laminas MVC**: register the `Contenir\Log` module (laminas-component-installer offers this automatically).
- **Mezzio**: add `Contenir\Log\ConfigProvider` to your config aggregator.

Configure
---------

[](#configure)

Override the `log` config key:

```
return [
    'log' => [
        'storage' => [
            // 'filesystem' (default) or 'db' — both are registered aliases.
            // You can also name any service id implementing StorageInterface.
            'adapter' => 'db',

            // Options for the chosen adapter:
            'options' => [
                // db:
                'adapter' => Laminas\Db\Adapter\Adapter::class, // db adapter service id
                'table'   => 'log',
                // LogRecord field => table column (only mapped fields are written;
                // a createdAt column with a DB default can be left out).
                'columns' => [
                    'message'      => 'message',
                    'error'        => 'error',
                    'priority'     => 'priority',
                    'priorityName' => 'priorityName',
                ],
                // Optional: route individual PSR-3 context entries to their own
                // columns. Only keys present on a given record are written, so a
                // domain id like student maps straight to an indexable column.
                'context' => [
                    'student' => 'student_id',
                ],

                // filesystem:
                // 'path' => 'data/log/app.log',
            ],
        ],
    ],
];
```

`adapter` is resolved through the container, so `'db'` / `'filesystem'` use the package's aliases, and you can register your own `StorageInterface` and name its service id here instead.

Use
---

[](#use)

Pull `Contenir\Log\Logger` from the container (it's a `Psr\Log\LoggerInterface`):

```
$logger->error('HTTP 500 at {uri}', ['uri' => $uri, 'exception' => $e]);
```

`{uri}` is a PSR-3 placeholder: any `{key}` in the message is replaced by the matching `context` entry, so the line above is recorded as `HTTP 500 at /checkout`.

`exception` is special-cased — it is **not** interpolated into the message. A `Throwable` passed there has its message chain and full stack trace captured separately (the `error` column, or a multi-line block in the file backend), keeping the message clean while preserving everything needed to debug.

`priority` / `priorityName` follow Laminas\\Log's numeric scheme, so existing log tables built for it remain compatible.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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 ~2 days

Total

5

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f377cb072a13f76c1b06d272c1f21f41903b3a90d9e1c5c6d928a955fe815441?d=identicon)[peptolab](/maintainers/peptolab)

---

Top Contributors

[![simon-mundy](https://avatars.githubusercontent.com/u/46739456?v=4)](https://github.com/simon-mundy "simon-mundy (8 commits)")

---

Tags

logpsr-3laminasmezziologgercontenir

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

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

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k54](/packages/ecotone-ecotone)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

187557.3k3](/packages/wikimedia-parsoid)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

521.1M24](/packages/apix-log)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2819.3k4](/packages/markrogoyski-simplelog-php)

PHPackages © 2026

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