echo-it / laravel-jsonapi by egeriis

12,892
146
6
Package Data
Maintainer Username: egeriis
Maintainer Contact: ronni@egeriis.me (Ronni Egeriis Persson)
Package Create Date: 2014-07-22
Package Last Update: 2016-11-18
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 15:02:35
Package Statistics
Total Downloads: 12,892
Monthly Downloads: 11
Daily Downloads: 0
Total Stars: 146
Total Watchers: 6
Total Forks: 27
Total Open Issues: 6

!!! Project abandoned. See cloudcreativity/laravel-json-api for a great alternative.

JSON API helpers for Laravel 5

Build Status

Make it a breeze to create a jsonapi.org compliant API with Laravel 5.

This library strives to be up to date with the latest JSON API updates—as the spec is still a work in progress. If you notice that something is missing, please contribute!

Installation

  1. Add echo-it/laravel-jsonapi to your composer.json dependency list (version 2.0.0 at the minimum for laravel 5 support)

  2. Run composer update.

Requirements

  • PHP 5.4+
  • Laravel 5

Using laravel-jsonapi

This library is made with the concept of exposing models in mind, as found in the RESTful API approach.

In few steps you can expose your models:

  1. Create a route to direct the requests

    In this example, we use a generic route for all models and HTTP methods:

    Route::any('{model}/{id?}', 'ApiController@handleRequest');
    
  2. Create your controller to handle the request

    Your controller is responsible to handling input, instantiating a handler class and returning the response.