lomkit / laravel-rest-api
A package to build quick and robust rest api for the Laravel framework.
Fund package maintenance!
GautierDele
Installs: 11 091
Dependents: 0
Suggesters: 0
Security: 0
Stars: 455
Watchers: 9
Forks: 24
Open Issues: 10
Requires
- php: ^8.0
- ext-json: *
- laravel/framework: ^10.0|^11.0
Requires (Dev)
- guzzlehttp/guzzle: ^6.0|^7.0
- laravel/scout: ^10.0|^11.0
- orchestra/testbench: ^8.5|^9.0
- phpunit/phpunit: ^8.0|^9.0|^10.0|^11.0
- dev-master
- v2.8.7
- v2.8.6
- v2.8.5
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.2.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0-beta
- v0.3.0-beta
- v0.2.0-beta
- v0.1.0-beta
This package is auto-updated.
Last update: 2024-11-07 14:55:45 UTC
README
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.1+ and Laravel 10.0+
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 / aggregates