evgeny-l/rest-api-core

REST API Core. Handles REST API requests and responses.
1,130 2
Install
composer require evgeny-l/rest-api-core
Latest Version:v0.8.0
PHP:>=7.0
License:MIT
Last Updated:Mar 10, 2022
Links: GitHub  ·  Packagist
Maintainer: evgeny-l

Laravel 5 REST API Core

Install

Require this package with composer using the following command:

composer require evgeny-l/rest-api-core

After updating composer, add the service provider to the providers array in config/app.php

EvgenyL\RestAPICore\RestAPICoreServiceProvider::class,

Publish the config file to config/rest-api-core.php

php artisan vendor:publish --provider="EvgenyL\RestAPICore\RestAPICoreServiceProvider" --tag=config

Install exceptions handler to app/Exceptions/Handler.php:

use EvgenyL\RestAPICore\Http\Exceptions\APIJSONHandlerTrait;

...
    public function render($request, Exception $exception)
    {
        if ($request->expectsJson()) {
            return $this->handleJSONResponse($request, $exception);
        }
        return parent::render($request, $exception);
    }
    
...

Install response middleware for JSON formatting into API middleware section:

\EvgenyL\RestAPICore\Http\Middleware\ResponseFormat::class

Related Packages

threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

10,364 13
sdv/laravel-endpoint

Laravel Endpoint is a CRUD REST API package for Laravel.

18,791 11
pixelpeter/laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API

106,547 123
marcelgwerder/laravel-api-handler

Package providing helper functions for a Laravel REST-API

94,344 155
infusionweb/laravel-marketo-rest-api

Provides a Laravel 5 service provider and facade for Marketo REST API Client.

271,651 0