28
JunLaravel API Responder is a package for making API responses, integrating Fractal into Laravel and Lumen. It can modify your data using transformers, formulate and serialize success- and error responses, handle exceptions. It also helps you with testing your responses.
When creating powerful APIs, you want to make sure your endpoints are compatible and easy to use by your application. Laravel is pertinent for your API, however, it lacks support for general tools like transformers and serializers. Yet Fractal has some great tools for building APIs and fills in the gaps of Laravel.
While Fractal resolves many of the lapses of Laravel. It’s usually a bit complex to integrate into the framework.
This package requires:
PHP 7.0+
Laravel 5.1+ or Lumen 5.1+
To get started, install the package through Composer:
composer require flugger/laravel-responder
After updating the composer, you’ve to add the following service provider to the providers key in config/app.php:
Flugg\Responder\ResponderServiceProvider::class
If you like facades, you can also add the Responder facade to the aliases key:
'Responder' => Flugg\Responder\Facades\Responder::class
You may also publish the package configuration and language file utilizing the Artisan command:
php artisan vendor:publish --provider="Flugg\Responder\ResponderServiceProvider"
This will publish a responder.php configuration file in your config folder.
It will also publish an errors.php file inside your lang/en folder which is used to save your error messages.
The package has a Flugg\Responder\Responder service which is capable of building success and error responses for your API.
For more details, you can see full documentation here.
flugg / laravel-responder
Published at : 28-06-2021
I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.
Launch project