Download the PHP package pepperfm/api-responder-for-laravel without Composer
On this page you can find all versions of the php package pepperfm/api-responder-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pepperfm/api-responder-for-laravel
More information about pepperfm/api-responder-for-laravel
Files in pepperfm/api-responder-for-laravel
Package api-responder-for-laravel
Short Description Easy api responder template using via DI
License MIT
Homepage https://github.com/pepperfm/api-responder-for-lravel
Informations about the package api-responder-for-laravel
Api responder for Laravel
A simple api response template using via DI
[!TIP] Full Package Description: Helpful advice for doing things better or more easily.
Installation
You can install the package via composer:
Usage
Simply using by laravel DI features.
In use section:
use Pepperfm\ApiBaseResponder\Contracts\ResponseContract;
Then any options you like:
for pagination
with some data mapping
or
Or would you prefer facades?
Paginated data in response
The helper-function paginate
accepts one argument of LengthAwarePaginator
type in backend and returns object of format:
Flexible data key
The package recognizes which method it was used from, and, according to REST, if you return one record from the show or edit methods, then the response will be in the
You can customize methods that should return this format in config file, as well any data-key you like
It's also possible to set any response data-key to any method you need, just add attribute under controller's method ResponseDataKey
to set response.data.entity
key, or pass any string as parameter:
Check the configuration file to customize response wrapping as you prefer
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.