2017 © Pedro Peláez
 

project rest-handler

A Laravel handler for custom exception on rest requests.

image

abstem/rest-handler

A Laravel handler for custom exception on rest requests.

  • Tuesday, November 14, 2017
  • by Abstem
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

RestHandler

Laravel Exception Handler For Rest Requests

If you need to render json responses in case of custom exceptions this is the perfect library for it., (*1)

Instalation

$ composer require abstem/rest-handler

Next, update the exception handler base class on the App/Exceptions/Handler.php from, (*2)

<?php
namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    //  Your Code here
}

to, (*3)

<?php
namespace App\Exceptions;

use Exception;
use Abstem\RestHandler\Exceptions\ExceptionHandler;

class Handler extends ExceptionHandler
{
    protected $handlers = [
        'You\Custom\Exception'  =>  'Your\Custom\Handler',    
    ];

    //  Your Code here
}

Simple as that, and on the Yourc\Custom\Handler you should receive a handle($request, $exception) method, (*4)

The Versions

14/11 2017

dev-master

9999999-dev

A Laravel handler for custom exception on rest requests.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

by Reginaldo Junior

laravel api rest restful abstem

14/11 2017

0.0.1

0.0.1.0

A Laravel handler for custom exception on rest requests.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

by Reginaldo Junior

laravel api rest restful abstem