imemento/exceptions-laravel

Laravel 的 HTTP 异常处理器

8.1.1 2021-07-28 14:20 UTC

README

Build Status Latest Stable Version License Total Downloads

这是一个自定义异常处理器,需要注册到 Laravel 中。

安装

composer require imemento/exceptions-laravel

将服务添加到 config/app.php 配置文件中

iMemento\Exceptions\Laravel\ExceptionsServiceProvider::class,

异常与格式化器的映射在 config/exceptions.php 文件中完成。

如果需要添加自定义映射,请发布它

php artisan vendor:publish --tag=config

替换 bootstrap/app.php 中的异常处理器

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    iMemento\Exceptions\Laravel\ExceptionHandler::class
);