josh / restexception
此包已被废弃,不再维护。未建议替代包。
处理带json响应的异常
dev-develop
2017-01-12 19:41 UTC
Requires
- anetwork/respond: ^0.0.12
- illuminate/database: ^5.3
- illuminate/http: ^5.3
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2022-03-29 00:26:36 UTC
README
Josh RestException
在Laravel中使用json响应处理异常
要求
- php 5.5 >=
使用Composer安装
您可以通过运行以下命令使用Composer安装此包:Composer
composer require josh/restexcpetion
在异常处理器中使用RestException
- 您应该在处理对象中使用RestException
- 异常处理器在此:
app\Exceptions\Hanldler.php
class Handler extends ExceptionHandler { /** * Use rest exception in class */ use \Josh\Exception\RestException;
- 然后在render方法中调用renderRestException方法
return $this->renderRestException($request , $exception);
许可
MIT许可(MIT)。请参阅许可文件以获取更多信息。