PHP code example of lanin / laravel-api-exceptions
1. Go to this page and download the library: Download lanin/laravel-api-exceptions library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lanin / laravel-api-exceptions example snippets
Lanin\Laravel\ApiExceptions\ApiExceptionsServiceProvider::class,
/**
* Format error message for API response.
*
* @param ApiException $exception
* @return mixed
*/
protected function formatApiResponse(ApiException $exception)
{
return [
'error' => $exception->toArray(),
];
}
namespace App\Exceptions;
use Lanin\Laravel\ApiExceptions\LaravelExceptionHandler;
class Handler extends LaravelExceptionHandler
{
}