lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.
67,688 600
Install
composer require lomkit/laravel-rest-api
Latest Version:v2.23.1
PHP:^8.2
License:MIT
Last Updated:Aug 6, 2026
Links: GitHub  ·  Packagist
Maintainer: GautierDele

Laravel Rest Api

Laravel Rest Api is an elegant way to expose your app through an API, it takes full advantage of the Laravel ecosystem such as Policies, Controllers, Eloquent, ...

Requirements

PHP 8.2+ and Laravel 12+

Documentation, Installation, and Usage Instructions

See the documentation for detailed installation and usage instructions.

What It Does

You'll find multiple endpoints exposed when using this package such as mutating, searching, showing, deleting, ...

Here is a quick look at what you can do using API search method:

// POST api/posts/search
{
    "search": {
        "scopes": [
            {"name": "withTrashed", "parameters": [true]}
        ],
        "filters": [
            {
                "field": "id", "operator": ">", "value": 1, "type": "or"
            },
            {
                "nested": [
                    {"field": "user.posts.id", "operator": "<", "value": 2},
                    {"field": "user.id", "operator": ">", "value": 3, "type": "or"}
                ]
            }
        ],
        "sorts": [
            {"field": "user_id", "direction": "desc"},
            {"field": "id", "direction": "asc"}
        ],
        "selects": [
            {"field": "id"}
        ],
        "includes": [
            {
                "relation": "posts",
                "filters": [
                     {"field": "id", "operator": "in", "value": [1, 3]}
                ],
                "limit": 2
            },
            {
                "relation": "user",
                "filters": [
                    {
                        "field": "languages.pivot.boolean",
                        "operator": "=",
                        "value": true
                    }
                ]
            }
        ],
        "aggregates": [
            {
                "relation": "stars",
                "type": "max",
                "field": "rate",
                "filters": [
                    {"field": "approved", "value": true}
                ]
            },
        ],
        "instructions": [
          {
            "name": "odd-even-id",
            "fields": [
              { "name": "type", "value": "odd" }
            ]
          }
        ],
        "gates": ["create", "view"],
        "page": 2,
        "limit": 10
    }
}

Roadmap

  • Metrics support
  • Refactor the response class
  • Alias for includes

Related Packages

api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

52,619,793 2,567
threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

10,353 13
pixelpeter/laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API

106,060 123
marcelgwerder/laravel-api-handler

Package providing helper functions for a Laravel REST-API

93,959 155
aimeos/aimeos-laravel

Cloud native, API first Laravel eCommerce package with integrated AI for ultra-f...

232,049 8,677