josh/restexception

This package is abandoned and no longer maintained. No replacement package was suggested.

Handle exceptions with json response

dev-develop 2017-01-12 19:41 UTC

This package is auto-updated.

Last update: 2022-03-29 00:26:36 UTC


README

Total Downloads Scrutinizer Code Quality License

Josh RestException

Handle Exceptions with json response in laravel

Requirement

  • php 5.5 >=

Install with composer

You can install this package throw the Composer by running:

composer require josh/restexcpetion

Use RestException in Exception Handler

  • you should use the RestException in Handler object
  • The Exception Handler is here app\Exceptions\Hanldler.php
class Handler extends ExceptionHandler
{
    /**
     * Use rest exception in class
     */
    use \Josh\Exception\RestException;
  • then call the renderRestException method in render method
return $this->renderRestException($request , $exception);

License

The MIT License (MIT). Please see License File for more information.