wboyz/laravel-api-responses is a Laravel package for api response helper for laravel..
It currently has 2 GitHub stars and 1.119 downloads on Packagist (latest version v0.5.2).
Install it with composer require wboyz/laravel-api-responses.
Discover more Laravel packages by wboyz
or browse all Laravel packages to compare alternatives.
Last updated
This is a helper package based on the Laracasts Incremental APIs tutorial series for returning correctly formed json responses for API calls.
Require this package with composer:
composer require wboyz/laravel-api-responses
After updating composer, add the ServiceProvider to the providers array in config/app.php:
WBoyz\LaravelApiResponses\WResponseServiceProvider::class,
If you want to use the facade, add this to your facades in app.php:
'WResp' => WBoyz\LaravelApiResponses\Facades\WResponse::class,
You can return responses using the Facade (when added), using the supported methods:
public function index() {
return WResp::respondNotFound('Not Found!');
}
You can now return responses using the global helper function wresponse:
public function index() {
return wresponse()->respondNotFound('Not Found!');
}