2017 © Pedro Peláez
 

library lumen-chained-exception-handler

A chained exception handler for the Lumen framework

image

nordsoftware/lumen-chained-exception-handler

A chained exception handler for the Lumen framework

  • Monday, December 19, 2016
  • by Jalle19
  • Repository
  • 15 Watchers
  • 5 Stars
  • 27,705 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 24 % Grown

The README.md

lumen-chained-exception-handler

GitHub Actions status Scrutinizer Code Quality Coverage Status Code Climate, (*1)

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., (*2)

Installation

Run the following command to install the package through Composer:, (*3)

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:, (*4)

$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., (*5)

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:, (*6)

$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:, (*7)

composer install

Run the following command to run the test suite:, (*8)

vendor/bin/phpunit

License

See LICENSE, (*9)

The Versions

19/12 2016

dev-master

9999999-dev

A chained exception handler for the Lumen framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

19/12 2016

dev-develop

dev-develop

A chained exception handler for the Lumen framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

09/12 2016

1.0.1

1.0.1.0

A chained exception handler for the Lumen framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall

09/12 2016

1.0.0

1.0.0.0

A chained exception handler for the Lumen framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sam Stenvall