Download the PHP package liuchang103/hyperf-exception without Composer
On this page you can find all versions of the php package liuchang103/hyperf-exception. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download liuchang103/hyperf-exception
More information about liuchang103/hyperf-exception
Files in liuchang103/hyperf-exception
Download liuchang103/hyperf-exception
More information about liuchang103/hyperf-exception
Files in liuchang103/hyperf-exception
Vendor liuchang103
Package hyperf-exception
Short Description hyperf exception api handler
License MIT
Package hyperf-exception
Short Description hyperf exception api handler
License MIT
Please rate this library. Is it a good library?
Informations about the package hyperf-exception
hyperf-exception
Hyperf 的异常错误处理,有 Json 和 View 自定义渲染
安装
引入包
使用
直接抛出 Json
直接抛出 View 视图
进阶
继承 Json
使用常量约定 code 码,让控制器中消失 “数字”
定义 Http 状态码
定义 json 格式
自定义传参
继承 View
使用常量约定 VIEW,让控制器中消失 “模版名”
定义 Http 状态码
自定义视图传参
自定义处理
如果需要自定义渲染,可继承 \HyperfException\Exception 并实现 render 方法,会接收 response 的对象
HTTP_STATUS 状态码是在更深一层的自定义处理中.
如果要自定义处理,可实现 handle 方法,同样会接收 response 的对象
(注意:实现 handle 方法后,HTTP_STATUS 常量将无效,render 渲染方法也将无效)
All versions of hyperf-exception with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.2
ext-swoole Version >=4.5
hyperf/framework Version 2.*
hyperf/di Version 2.*
ext-swoole Version >=4.5
hyperf/framework Version 2.*
hyperf/di Version 2.*
The package liuchang103/hyperf-exception contains the following files
Loading the files please wait ....