PHPackages                             gregorip02/restql - 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. gregorip02/restql

ActiveLibrary[Database &amp; ORM](/categories/database)

gregorip02/restql
=================

A data resolution package for Laravel

v2.9.2(5y ago)1272566[3 issues](https://github.com/gregorip02/restql/issues)LGPL-3.0PHPPHP ^7.1|^8.0CI failing

Since Mar 19Pushed 4y ago6 watchersCompare

[ Source](https://github.com/gregorip02/restql)[ Packagist](https://packagist.org/packages/gregorip02/restql)[ Fund](https://www.buymeacoffee.com/BgHiZ9b)[ RSS](/packages/gregorip02-restql/feed)WikiDiscussions stable Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (27)Used By (0)

RestQL
======

[](#restql)

[![License](https://camo.githubusercontent.com/cb687288607af2a748c9a211c0d1eb9039bdacd69cdba582157a825b5ad1af57/68747470733a2f2f706f7365722e707567782e6f72672f677265676f72697030322f72657374716c2f6c6963656e7365)](//packagist.org/packages/gregorip02/restql)[![Latest Stable Version](https://camo.githubusercontent.com/134531762a22b937119b3644988dbd64cc476d79aa643076de249d461935a4cd/68747470733a2f2f706f7365722e707567782e6f72672f677265676f72697030322f72657374716c2f76)](//packagist.org/packages/gregorip02/restql)[![Total Downloads](https://camo.githubusercontent.com/c4591ecf365cff16797a8cbff93db318e75a755973ec343efb51ffc846b0552d/68747470733a2f2f706f7365722e707567782e6f72672f677265676f72697030322f72657374716c2f646f776e6c6f616473)](//packagist.org/packages/gregorip02/restql)[![Actions Status](https://github.com/gregorip02/restql/workflows/tests/badge.svg)](https://github.com/gregorip02/restql/actions)

RestQL is a Laravel eloquent-based data resolution package. This package tries to adopt **GraphQL** principles solving only the data that the client requests. RestQL uses your **Laravel** models as an entry point to add queries to then based in the eloquent methods.

**Please see the [documentation](https://github.com/gregorip02/restql/wiki).**

[![Laravel RestQL](./example.png)](./example.png)

**Why?**
--------

[](#why)

Imagine you have an application that manages authors, these authors can publish articles and those articles can have comments from different authors. You have a web client, for example, that uses **fetch** to consume the data offered by your service and somewhere in your code, you need a list of the **author's names only**.

They wear something like that.

```
fetch('https://laravel.app/api/authors')
  .then((res) => res.json())
  .then(({ data }) => console.log(data.authors));
```

So, you have a route like this.

`routes/api.php`

```
