PHPackages                             contenir/errors-laminas-mvc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. contenir/errors-laminas-mvc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

contenir/errors-laminas-mvc
===========================

Laminas MVC adapter for contenir/errors — swaps the default error rendering with admin-authored per-status pages.

v0.3.1(4w ago)034MITPHPPHP ^8.1 || ^8.2 || ^8.3

Since May 6Pushed 3w agoCompare

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

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

contenir/errors-laminas-mvc
===========================

[](#contenirerrors-laminas-mvc)

Laminas MVC adapter for [`contenir/errors`](https://github.com/contenir/errors).

Replaces the framework's default 4xx/5xx rendering with admin-authored per-status pages when configured. Non-invasive on first install — when the admin hasn't authored a page for a given status, the framework's default rendering proceeds unchanged.

Install
-------

[](#install)

```
composer require contenir/errors-laminas-mvc
```

The Module is auto-registered by `laminas/laminas-component-installer`.

Configure
---------

[](#configure)

Point the package at a shared error-pages file (the same path the admin writes to) and optionally wire a PSR-3 logger:

```
// config/autoload/errors.global.php

return [
    'errors' => [
        'file'          => realpath(__DIR__ . '/../..') . '/configs/errors.local.php',
        'view_template' => 'contenir/errors/fault',  // override to use a Site-owned template
        'logger'        => 'log.psr3',                // optional PSR-3 service ID
    ],
];
```

`file` is required. `view_template` defaults to the package's shipped `contenir/errors/fault.phtml` (uses the `.fault` BEM block, no scripts, ``, single "Return home" link). `logger` may be `null`, a service ID resolvable from the container, or a `Psr\Log\LoggerInterface` instance.

How it works
------------

[](#how-it-works)

The `ErrorListener` attaches at `MvcEvent::EVENT_RENDER` and `EVENT_RENDER_ERROR` at priority `100`. By the time RENDER fires, the response status is already settled (RouteNotFoundStrategy has set 404, ExceptionStrategy has set 500, or a controller has called `setStatusCode(403)`). The listener:

1. Logs the 4xx/5xx via the optional PSR-3 logger (`info()` for 4xx, `error()` for 5xx, with the exception in context if available).
2. If the repository has a non-empty page for the status, swaps the result `ViewModel` template + variables (`status`, `title`, `body`) and marks it terminal so the layout is bypassed.
3. Otherwise leaves the existing render path untouched.

Override the view
-----------------

[](#override-the-view)

To brand the page beyond what's possible in the body field, set `errors.view_template` to your own template name:

```
'errors' => [
    'view_template' => 'site/error-page',
],
```

Your template receives:

VariableTypeNotes`$status``int`HTTP status code (e.g. 404)`$title``string`Plain text written by the admin`$body``string`Sanitized HTML fragment (inline only) — render rawThe body is *trusted* — sanitization is the writer's responsibility (see the admin-side wiring in the consuming CMS). Render with ``.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance94

Actively maintained with recent releases

Popularity11

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

28d 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)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/contenir-errors-laminas-mvc/health.svg)

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

###  Alternatives

[magento/community-edition

Magento 2 (Open Source)

12.1k53.0k12](/packages/magento-community-edition)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[ecotone/ecotone

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

562565.8k41](/packages/ecotone-ecotone)[kokspflanze/bjy-authorize

Laminas\\Acl based firewall system for Mezzio dispatch protection

20194.8k4](/packages/kokspflanze-bjy-authorize)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68353.9k](/packages/run-as-root-magento2-prometheus-exporter)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1010.0k22](/packages/loki-magento2-components)

PHPackages © 2026

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