PHPackages                             enjoyscms/error-handler - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. enjoyscms/error-handler

Abandoned → [enjoys/error-handler](/?search=enjoys%2Ferror-handler)ArchivedLibrary[Debugging &amp; Profiling](/categories/debugging)

enjoyscms/error-handler
=======================

2.1.1(3y ago)0485MITPHPPHP ^8.0

Since Jun 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/EnjoysCMS/error-handler)[ Packagist](https://packagist.org/packages/enjoyscms/error-handler)[ RSS](/packages/enjoyscms-error-handler/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (10)Used By (0)

### ErrorHandler

[](#errorhandler)

```
$errorHandler = new \EnjoysCMS\ErrorHandler\ErrorHandler(
    request: $request, //required, Psr\Http\Message\ServerRequestInterface::class
    emitter: $emitter, //required, EnjoysCMS\Core\Interfaces\EmitterInterface::class
    responseFactory: $responseFactory, //required, Psr\Http\Message\ResponseFactoryInterface::class
    logger: $logger,  // Psr\Log\LoggerInterface::class or null
);

// Все ошибки будут выводиться с http статусом 500, с помощью setErrorsMap() можно переопределить статусы ошибок.
// По-умолчанию в logger передаваться ничего не будет.
$errorHandler->setErrorsMap([
    404 => [
        NotFoundException::class,
        NoResultException::class,
        //...
    ],
    403 => [
        ForbiddenException::class
    ]
]);

// Установка другого шаблона для вывода ошибок в HTML
\EnjoysCMS\ErrorHandler\Output\Html::setHtmlTemplater(
    // Реализация \EnjoysCMS\ErrorHandler\View\ViewInterface
    // уже внутри реализации можно настроить разные шаблоны под
    // разные ошибки, например для 404 и 403
    new \EnjoysCMS\ErrorHandler\View\SimpleHtmlViewVerbose()
);

// Для передачи ошибки в logger, необходимо сопоставить ошибки с уровнем лога при помощи setLoggerTypeMap()
$errorHandler->setLoggerTypeMap([
    // для конкретно этой ошибки, будет вызван $logger->info()
    NoResultException::class => ['info'],
    // для конкретно этой ошибки, будет вызван $logger->debug() и $logger->warning()
    NotFoundException::class => ['debug', 'warning'],
    // для всех ошибок со статусом 500 будет вызван $logger->error()
    500 => ['error'],
    // эта ошибка со статусом 500 вызвать $logger->error() НЕ будет, но будет вызван $logger->critical()
    \InvalidArgumentException::class => ['critical'],
    //...
]);

try {
    // ... something code
} catch(\Throwable $error) {
    $errorHandler->handle($error);
}
```

### ErrorHandlerMiddleware

[](#errorhandlermiddleware)

```
$errorHandler = new \EnjoysCMS\ErrorHandler\ErrorHandler();
// ... more setting error handler
$errorHandlerMiddleware = new \EnjoysCMS\ErrorHandler\ErrorHandlerMiddleware($errorHandler);
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Recently: every ~97 days

Total

9

Last Release

1021d ago

Major Versions

1.0.9 → 2.0.02023-05-17

2.1.1 → 6.x-dev2023-09-16

PHP version history (3 changes)1.0.0PHP &gt;=8.0

2.0.0PHP ^8.0

6.x-devPHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25447823?v=4)[enjoys](/maintainers/enjoys)[@enjoys](https://github.com/enjoys)

---

Top Contributors

[![Enjoyzz](https://avatars.githubusercontent.com/u/1448659?v=4)](https://github.com/Enjoyzz "Enjoyzz (34 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/enjoyscms-error-handler/health.svg)

```
[![Health](https://phpackages.com/badges/enjoyscms-error-handler/health.svg)](https://phpackages.com/packages/enjoyscms-error-handler)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

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

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)

PHPackages © 2026

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