nordsoftware/lumen-chained-exception-handler 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nordsoftware/lumen-chained-exception-handler

最新稳定版本:3.1.0

Composer 安装命令:

composer require nordsoftware/lumen-chained-exception-handler

包简介

A chained exception handler for the Lumen framework

README 文档

README

GitHub Actions status Scrutinizer Code Quality Coverage Status Code Climate

This utility allows you to chain together multiple exception handlers in your Lumen application. This can be useful if you want to use the rendering capabilities of the default exception handler, but you want to use the reporting logic from a third-party exception handler. The reporting logic can usually be extended by adding another Monolog handler, but all exceptions will be mangled into strings which is not always feasible.

Installation

Run the following command to install the package through Composer:

composer require nordsoftware/lumen-chained-exception-handler

Usage

Replace the $app->singleton() call which registers the concrete exception handler in bootstrap/app.php with the following:

$app->instance(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    new Nord\Lumen\ChainedExceptionHandler\ChainedExceptionhandler(
        new App\Exceptions\Handler()
    )
);

The constructor takes two parameters, a primary exception handler and an optional array of secondary handlers. The report() method will be called on all handlers, but the render() and renderForConsole() methods will only be called on the primary handler.

For example, if want to use the default Laravel\Lumen\Exceptions\Handler as your primary error handler and Foo\Bar\ExceptionHandler and Baz\ExceptionHandler as secondary exception handlers, you would use this:

$app->instance(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    new Nord\Lumen\ChainedExceptionHandler\ChainedExceptionhandler(
        new Laravel\Lumen\Exceptions\Handler(),
        [new Foo\Bar\ExceptionHandler(), new Baz\ExceptionHandler()]
    )
);

Running tests

Clone the project and install its dependencies by running:

composer install

Run the following command to run the test suite:

vendor/bin/phpunit

License

See LICENSE

统计信息

  • 总下载量: 595.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 12
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-09