New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.
82,028 600
Install
composer require lomkit/laravel-rest-api
Latest Version:v2.23.2
PHP:^8.2
Laravel:12 · 13
Older releases:8 – 11
License:MIT
Last Updated:Oct 29, 2026
Links: GitHub  ·  Packagist
Maintainer: GautierDele

Social Card of Laravel Permission

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

cline/relay

A modern, attribute-driven HTTP client for PHP

10,803 0
nebo15/lumen.rest

Components for fast building REST API for Lumen

3,761 1
wisoot/jwt-guard

Laravel Guard Driver using JSON Web Token (JWT)

703 6
lujo/lumen-rest

Lumen package for creating simple REST API

97 1
izupet/laravel-api

Laravel REST api helpers

63 6

Version History

Version Released PHP Laravel License
v2.23.2 ^8.2 ^12|^13 MIT
v2.23.1 ^8.2 ^12|^13 MIT
v2.23.0 ^8.2 ^12|^13 MIT
v2.22.3 ^8.2 ^12|^13 MIT
v2.22.2 ^8.2 ^12|^13 MIT
Pre-releases (4)
Version Released PHP Laravel License
v0.4.0-beta ^7.3|^8.0 ^8.37|^9.0|^10.0 MIT
v0.3.0-beta ^7.3|^8.0 ^8.37|^9.0|^10.0 MIT
v0.2.0-beta ^7.3|^8.0 ^8.37|^9.0|^10.0 MIT
v0.1.0-beta ^7.3|^8.0 ^8.37|^9.0|^10.0 MIT