PHPackages                             nilportugues/laravel5-json-api-dingo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nilportugues/laravel5-json-api-dingo

ActiveLibrary[API Development](/categories/api)

nilportugues/laravel5-json-api-dingo
====================================

Laravel5 JSONAPI and Dingo together to build APIs fast

1.0.2(9y ago)311.5k3[6 issues](https://github.com/nilportugues/laravel5-jsonapi-dingo/issues)MITPHP

Since Jul 2Pushed 9y agoCompare

[ Source](https://github.com/nilportugues/laravel5-jsonapi-dingo)[ Packagist](https://packagist.org/packages/nilportugues/laravel5-json-api-dingo)[ Docs](http://nilportugues.com)[ RSS](/packages/nilportugues-laravel5-json-api-dingo/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

Laravel 5 JSON API Mappings with Dingo
======================================

[](#laravel-5-json-api-mappings-with-dingo)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dabd31784e66c203293a7af96ddcafe39073f7fad8f2133939a984846e013fed/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e696c706f727475677565732f6c61726176656c352d6a736f6e6170692d64696e676f2f6261646765732f7175616c6974792d73636f72652e706e673f3f623d6d6173746572)](https://scrutinizer-ci.com/g/nilportugues/laravel5-jsonapi-dingo/?branch=master) [![SensioLabsInsight](https://camo.githubusercontent.com/0ebd8e5c0028fb12e85c14d65cef2aa5d71a8072bb7b64fe231494f8162f7fbd/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63346662316236352d653634392d343634662d623738632d6535383032373433613738662f6d696e692e706e673f)](https://insight.sensiolabs.com/projects/c4fb1b65-e649-464f-b78c-e5802743a78f)[![Latest Stable Version](https://camo.githubusercontent.com/4e8c1b6c066867d910277fb61fd3ab85e5e3169f9ccae693601842d55394148b/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f6c61726176656c352d6a736f6e2d6170692d64696e676f2f762f737461626c65)](https://packagist.org/packages/nilportugues/laravel5-json-api-dingo)[![Total Downloads](https://camo.githubusercontent.com/2ef737a3f779cd5d34b30123039a4ecdbe95b08ae0f1f7fb0678eb6a078dd5be/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f6c61726176656c352d6a736f6e2d6170692d64696e676f2f646f776e6c6f616473)](https://packagist.org/packages/nilportugues/laravel5-json-api-dingo)[![License](https://camo.githubusercontent.com/3e11e33d2d0fab4bb2e402ae0d67979e3d6e5982084b39f69508e0f426039c06/68747470733a2f2f706f7365722e707567782e6f72672f6e696c706f727475677565732f6c61726176656c352d6a736f6e2d6170692d64696e676f2f6c6963656e7365)](https://packagist.org/packages/nilportugues/laravel5-json-api-dingo)[![Donate](https://camo.githubusercontent.com/7b6de155df30b37b25eb5fec52f9213680c3dbf067dfb7d7e2850ac4096c7d05/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e6174655f534d2e676966)](https://paypal.me/nilportugues)

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [JsonApiController](#jsonapicontroller)
- [Examples: Consuming the API](#examples-consuming-the-api)
    - [GET](#get)
    - [POST](#post)
    - [PUT](#put)
    - [PATCH](#patch)
    - [DELETE](#delete)
- [GET Query Params: include, fields, sort and page](#get-query-params-include-fields-sort-and-page)
- [POST/PUT/PATCH with Relationships](#postputpatch-with-relationships)
- [Custom Response Headers](#custom-response-headers)
- [Common Errors and Solutions](#common-errors-and-solutions)

This package makes [Laravel 5 JSON API Server Package](https://github.com/nilportugues/laravel5-jsonapi) and [Dingo](https://github.com/dingo/api) play well together by using Dingo's API routing system instead of Laravel's.

By doing this you get the automatic formatting of the JSON API mappings and the versioning and security offered by Dingo.

Features
--------

[](#features)

- Package provides a full implementation of the **[JSON API](https://github.com/json-api/json-api)** specification, and is **featured** on the official site!
- A **JSON API Transformer** that will allow you to convert any mapped object into a valid JSON API resource.
- Controller boilerplate to write a fully compiliant **JSON API Server** using your **exisiting Eloquent Models**.
- **Dingo features such as:**
    - Multiple Authentication Adapters
    - API Versioning
    - Rate Limiting
    - Internal Requests
    - API Blueprint Documentation

Installation
------------

[](#installation)

Use [Composer](https://getcomposer.org) to install the package:

```
$ composer require nilportugues/laravel5-json-api-dingo

```

Now run the following artisan command:

```
$ php artisan vendor:publish

```

Configuration
-------------

[](#configuration)

Open up `config/app.php` and add the following line under `providers` array:

```
'providers' => [
    //...
    NilPortugues\Laravel5\JsonApiDingo\Laravel5JsonApiDingoServiceProvider::class,
],
```

Usage
-----

[](#usage)

### Defining routes

[](#defining-routes)

We will be planning the resources ahead its implementation. All routes require to have a name.

This is how our `app/Http/routes.php` will look:

```
