PHPackages                             echo-it/laravel-jsonapi - 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. echo-it/laravel-jsonapi

ActiveLibrary[API Development](/categories/api)

echo-it/laravel-jsonapi
=======================

v2.4.2(10y ago)14513.1k27[6 issues](https://github.com/echo-it/laravel-jsonapi/issues)MITPHP

Since Jul 22Pushed 9y ago6 watchersCompare

[ Source](https://github.com/echo-it/laravel-jsonapi)[ Packagist](https://packagist.org/packages/echo-it/laravel-jsonapi)[ RSS](/packages/echo-it-laravel-jsonapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (33)Used By (0)

**!!!** Project abandoned. See [cloudcreativity/laravel-json-api](https://github.com/cloudcreativity/json-api/) for a great alternative.

JSON API helpers for Laravel 5
==============================

[](#json-api-helpers-for-laravel-5)

[![Build Status](https://camo.githubusercontent.com/e70bf263a40c88ed8766ce4d12c0f9aad7ada05104996d0309244edf91aa3179/68747470733a2f2f7472617669732d63692e6f72672f6563686f2d69742f6c61726176656c2d6a736f6e6170692e737667)](https://travis-ci.org/echo-it/laravel-jsonapi)

Make it a breeze to create a [jsonapi.org](http://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
------------

[](#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

[](#requirements)

- PHP 5.4+
- Laravel 5

Using laravel-jsonapi
---------------------

[](#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.

    ```
    ```

fulfillRequest(); } catch (ApiException $e) { return $e-&gt;response(); } return $res-&gt;toJsonResponse(); } // If a handler class does not exist for requested model, it is not considered to be exposed in the API return new ApiErrorResponse(404, 404, 'Entity not found'); } } ``` 3. \*\*Create a handler for your model\*\* A handler is responsible for exposing a single model. In this example we have create a handler which supports the following requests: \* GET /users (ie. handleGet function) \* GET /users/\[id\] (ie. handleGet function) \* PUT /users/\[id\] (ie. handlePut function) Requests are automatically routed to appropriate handle functions. ```php handleGetDefault($request, new User); } /\*\* \* Handles PUT requests. \* @param EchoIt\\JsonApi\\Request $request \* @return EchoIt\\JsonApi\\Model|Illuminate\\Support\\Collection|EchoIt\\JsonApi\\Response \*/ public function handlePut(ApiRequest $request) { //you can use the default PUT functionality, or override with your own return $this-&gt;handlePutDefault($request, new User); } } ``` &gt; \*\*Note:\*\* Extend your models from `EchoIt\\JsonApi\\Model` rather than `Eloquent` to get the proper response for linked resources. Current features ----- According to \[jsonapi.org\](): \* \[Resource Representations\]() as resource objects \* \[Resource Relationships\]() \* Only through \[Inclusion of Linked Resources\]() \* \[Compound Documents\]() \* \[Sorting\]() \* \[Filtering\]() \* \[Pagination\] () The features in the Handler class are each in their own function (eg. handlePaginationRequest, handleSortRequest, etc.), so you can easily override them with your own behaviour if desired. Wishlist ----- \* Nested requests to fetch relations, e.g. /users/\[id\]/friends \* \[Resource URLs\]() \* Requests for multiple \[individual resources\](), e.g. `/users/1,2,3` \* \[Sparse Fieldsets\]() \* Some kind of caching mechanism

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

32

Last Release

3854d ago

Major Versions

v1.2.14 → v2.02015-03-03

v1.3 → v2.42015-09-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/de5531e89bb1f4835f613fc44112436b9a3b2dab43a689e2059536ce5e7c35a2?d=identicon)[egeriis](/maintainers/egeriis)

---

Top Contributors

[![egeriis](https://avatars.githubusercontent.com/u/579824?v=4)](https://github.com/egeriis "egeriis (69 commits)")[![jpchip](https://avatars.githubusercontent.com/u/1489549?v=4)](https://github.com/jpchip "jpchip (13 commits)")[![pmccarren](https://avatars.githubusercontent.com/u/4959702?v=4)](https://github.com/pmccarren "pmccarren (12 commits)")[![mfn](https://avatars.githubusercontent.com/u/87493?v=4)](https://github.com/mfn "mfn (11 commits)")[![ninjapenguin](https://avatars.githubusercontent.com/u/38786?v=4)](https://github.com/ninjapenguin "ninjapenguin (9 commits)")[![IAmJulianAcosta](https://avatars.githubusercontent.com/u/1844640?v=4)](https://github.com/IAmJulianAcosta "IAmJulianAcosta (7 commits)")[![wireblue](https://avatars.githubusercontent.com/u/1072538?v=4)](https://github.com/wireblue "wireblue (2 commits)")[![cdarken](https://avatars.githubusercontent.com/u/1390998?v=4)](https://github.com/cdarken "cdarken (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/echo-it-laravel-jsonapi/health.svg)

```
[![Health](https://phpackages.com/badges/echo-it-laravel-jsonapi/health.svg)](https://phpackages.com/packages/echo-it-laravel-jsonapi)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
