alighorbani/responder
Make a Response to as fast as light!
1,019
1
| Install | |
|---|---|
composer require alighorbani/responder:dev-master |
|
| PHP: | 8.0.* |
| License: | MIT |
| Last Updated: | Jun 7, 2022 |
| Links: | GitHub · Packagist |
Maintainer: alighorbani
🚀 Generate API Response as fast as light!
We solve some problem for You with a package You can call Responder
actually developers make a specific structure for api that developed
✅️ Advantages
- You don't need to set pagination logic in your resource because inject automatically
- You can make a different response with elegant syntax (use facade)
- Automatic Message Mapper on response for example(title => users-list)
- Prevent Human mistakes when generate response structure manually
- Unlimited Define Structure and used in project
- If you decide to Change Your you can do this with little changed
👨💻 Usage
In this Example use the resource that contains several items (such as users list)
<?php
use Jenssegers\Mongodb\Eloquent\Model;
use Alighorbani\Responder\ResponderFacade;
class UserController extends Model
{
public function getUsersList()
{
$users = User::all();
return ResponderFacade::resourceResponse($users, 'USERS.LIST', UserResource::class);
}
}
{
"success": true,
"title": "The List of Users Resource",
"result": [
{
"id": 1,
"name" : "Ali",
"lastname" : "Ghorbani",
"birthday" : "2003-01-01"
},
{
"id": 2,
"name" : "Mohammad",
"lastname" : "Karimi",
"birthday" : "2003-02-18"
}
]
}
TODO
- Installing With Composer Package & Dependencis
- how to use the make responder
- how to use the message config
- how to use the macroable on this package (to add functionality)
Related Packages
danjamesmills/laravel-response
A Laravel package to standardise and simplify API responses, providing consisten...
3,803
1
padosoft/laravel-request
Laravel Package to interact with Illuminate Request and Files Upload.
919
2