PHPackages                             sarala-io/laravel-companion - 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. [Database &amp; ORM](/categories/database)
4. /
5. sarala-io/laravel-companion

Abandoned → [https://github.com/sarala-io/sarala-laravel](/?search=https%3A%2F%2Fgithub.com%2Fsarala-io%2Fsarala-laravel)Library[Database &amp; ORM](/categories/database)

sarala-io/laravel-companion
===========================

Laravel support library for JSON-API developers.

v0.0.3(8y ago)32.3kMITPHPPHP ^7.1.3

Since Mar 7Pushed 7y ago3 watchersCompare

[ Source](https://github.com/sarala-io/laravel-companion)[ Packagist](https://packagist.org/packages/sarala-io/laravel-companion)[ Docs](https://github.com/sarala-io/laravel-companion)[ RSS](/packages/sarala-io-laravel-companion/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (7)Versions (6)Used By (0)

> Important: This package is not actively maintained. For bug fixes and new features, please fork. or take a look at [sarala-io/sarala](https://sarala-io.github.io/sarala-laravel-docs/guide/)

Sarala Laravel Companion
========================

[](#sarala-laravel-companion)

> [Laravel](https://github.com/laravel/laravel) support package to easily develop REST API following [JSON API specification](http://jsonapi.org/format/1.1/#document-top-level).

[![Latest Version on Packagist](https://camo.githubusercontent.com/d8d588a4f03526acec6babd61e854f8fe274f681acf8342c522b37dab77f5e32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736172616c612d696f2f6c61726176656c2d636f6d70616e696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarala-io/laravel-companion)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/687ab1a9e2cb7213d2b87d2ea157bf46ab29cfff5387152a8943b3348bf95ef8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736172616c612d696f2f6c61726176656c2d636f6d70616e696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sarala-io/laravel-companion)[![Coverage Status](https://camo.githubusercontent.com/3edf293ab9942dca7080fbfa1235519cdc4b1b5b1b2a66de2c2a1f2600b7851b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f736172616c612d696f2f6c61726176656c2d636f6d70616e696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/sarala-io/laravel-companion/code-structure)[![Quality Score](https://camo.githubusercontent.com/a0a64a010014e3a5187c113ebebd1575ff422f40f9987714eb5ede91ab997ecf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736172616c612d696f2f6c61726176656c2d636f6d70616e696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/sarala-io/laravel-companion)[![Total Downloads](https://camo.githubusercontent.com/5aaf7b87c3a0d9ba39075f61a13e32c74b793bbb486f1fd8ba36fa0b41876be0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736172616c612d696f2f6c61726176656c2d636f6d70616e696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarala-io/laravel-companion)[![StyleCI](https://camo.githubusercontent.com/281d7407c55b8ebb3e37b6b170d8411541a8f79774426935c9754164a6287a28/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132333935323236342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/123952264)

Install
-------

[](#install)

Via Composer

```
$ composer require sarala-io/laravel-companion
```

Usage
-----

[](#usage)

Eloquent model implementation

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Sarala\Filterable;

class Post extends Model
{
    use Filterable;

    ...
}
```

Dedicated query filter implementation

```
namespace App\Filters;

use Sarala\FilterAbstract;

class PostsFilter extends FilterAbstract
{
    protected $lookup = [
        'my' => 'composedByMe'
    ];

    public function composedByMe()
    {
        return $this->builder->composedBy(auth()->user());
    }

    ...
}
```

Controller implementation

```
namespace App\Http\Controllers;

use App\Post;
use App\Filters\PostsFilter;
use App\Http\Transformers\PostTransformer;
use Sarala\JsonApiResponse;
use Illuminate\Http\Request;

class PostController extends Controller
{
    public function index(Request $request, PostsFilter $filters)
    {
        $data = Post::filter($filters)->paginateOrGet($request);

        return new JsonApiResponse($data, new PostTransformer(), 'posts');
    }

    public function show(Post $post, PostsFilter $filter)
    {
        $data = Post::filter($filter)->find($post->id);

        return new JsonApiResponse($data, new PostTransformer(), 'posts');
    }

    ...
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Milroy Fraser](https://github.com/milroyfraser)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Total

3

Last Release

2964d ago

PHP version history (2 changes)v0.0.1PHP ~5.6|~7.0

v0.0.3PHP ^7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f3ba1935044647e51c405868792beea05a76250a8f7ef408c9b706edf51fcb6?d=identicon)[milroy.me](/maintainers/milroy.me)

---

Top Contributors

[![milroyfraser](https://avatars.githubusercontent.com/u/3282475?v=4)](https://github.com/milroyfraser "milroyfraser (14 commits)")

---

Tags

eloquentjson-apilaravelrest-apirestfullaraveleloquentrestfulJSON-API

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sarala-io-laravel-companion/health.svg)

```
[![Health](https://phpackages.com/badges/sarala-io-laravel-companion/health.svg)](https://phpackages.com/packages/sarala-io-laravel-companion)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[io238/laravel-iso-countries

Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.

5462.3k](/packages/io238-laravel-iso-countries)

PHPackages © 2026

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