Package Data | |
---|---|
Maintainer Username: | nalatreb |
Maintainer Contact: | bertalan.verebelyi@gmail.com (Bertalan Verebelyi) |
Package Create Date: | 2016-03-30 |
Package Last Update: | 2016-04-24 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:22:04 |
Package Statistics | |
---|---|
Total Downloads: | 1,118 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
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!');
}