RestQL Data Resolution Package for Laravel

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: News


Join 31,000+ others and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Full-Stack Engineer
[REMOTE: USA Only] All Other Applications Will be Rejected Immediately"
Senior Full Stack PHP Developer
Motto Design Studio
👉 Looking for Senior Back-End Laravel API Developer - Immediate (Full-time Contractor) 🎉
Remote // The Document Signing Experience™
Senior Full-Stack Developer
Remote, USA Only
Senior Full Stack Engineer
Remote / Los Angeles, USA
Entertainment Media