Download the PHP package jnewer/exception-handler without Composer
On this page you can find all versions of the php package jnewer/exception-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download jnewer/exception-handler
More information about jnewer/exception-handler
Files in jnewer/exception-handler
Download jnewer/exception-handler
More information about jnewer/exception-handler
Files in jnewer/exception-handler
Vendor jnewer
Package exception-handler
Short Description Webman plugin jnewer/exception-handler
License MIT
Package exception-handler
Short Description Webman plugin jnewer/exception-handler
License MIT
Please rate this library. Is it a good library?
Informations about the package exception-handler
webman exception handler 异常插件
该插件扩展了webman的Handler类,webman的Handler只能对同一应用下的异常进行统一处理,而该插件可以针对同一应用的不同异常进行不同的处理。
安装
配置
config/exception.php
config/plugin/jnewer/exception-handler.php
多应用模式时,你可以为每个应用单独配置异常处理类,参见多应用
基本用法
以上异常抛出错误信息,如下格式:
内置异常类
- 客户端异常类(HTTP Status 400):NotFoundHttpException
- 身份认证异常类(HTTP Status 401):UnauthorizedHttpException
- 资源授权异常类(HTTP Status 403):ForbiddenHttpException
- 资源未找到异常类(HTTP Status 404):NotFoundHttpException
- 请求方法不允许异常类(HTTP Status 405):MethodNotAllowedHttpException
- 请求内容类型不支持异常类(HTTP Status 406):NotAcceptableHttpException
- 请求限流在异常类(HTTP Status 429):TooManyRequestsHttpException
- 服务器内部错误异常类(HTTP Status 500):ServerErrorHttpException
更多参考:https://datatracker.ietf.org/doc/html/rfc7231#page-47
自定义异常类
使用异常类
内置异常类Handler
- 扩展自webman的Handler:Handler,可以针对不同的异常类进行不同的处理。
- BaseException异常处理:BaseExceptionHandler
- laravel验证器异常处理:ValidationExceptionHandler
自定义异常类Handler
配置Handler
config/plugin/jnewer/exception-handler.php
All versions of exception-handler with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.1
ext-json Version *
illuminate/validation Version >=8.0
workerman/webman-framework Version >=2.1
ext-json Version *
illuminate/validation Version >=8.0
workerman/webman-framework Version >=2.1
The package jnewer/exception-handler contains the following files
Loading the files please wait ....