RestQL Data Resolution Package for Laravel


April 30th, 2020

RestQL Data Resolution Package for Laravel

RestQL is a data resolution package for your Laravel models by Gregori Piñeres:

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 on the eloquent methods.

This package has data resolution clauses, which are a way to improve queries based on parameters provided by the client. It’s RESTful but uses principles from GraphQL.

From the project’s readme, here’s an example of the RestQL route:

use Restql\Restql;
use Illuminate\Http\Request;
// The RestQL endpoint.
Route::get('restql', function (Request $request) {
return Restql::resolve($request);

And with that route, how you might use this package on the frontend to retrieve author names:

axios.get('', {
params: {
authors: {
select: 'name'
}).then(({ data: authors }) => {
// Do something...

Finally, you’d get the following JSON back:

"authors": [
{ "id": 1, "name": "Kasey Yost" },
{ "id": 2, "name": "Ike Barton" },
{ "id": 3, "name": "Emie Daniel" },

Learn More

You can learn more about this package, get full installation instructions, and view the source code on GitHub at gregorip02/restql.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.