Package Data | |
---|---|
Maintainer Username: | cuonggt |
Maintainer Contact: | thaicuong.giang@gmail.com (Giang Thai Cuong) |
Package Create Date: | 2016-09-28 |
Package Last Update: | 2019-03-07 |
Home Page: | https://packagist.org/packages/gtk/gapi |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-05-10 15:16:36 |
Package Statistics | |
---|---|
Total Downloads: | 546 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 8 |
Total Watchers: | 4 |
Total Forks: | 2 |
Total Open Issues: | 0 |
Gapi provides a simple, convenient way to handle your API response properly.
Install via composer - edit your composer.json
to require the package.
"require": {
"gtk/gapi": "dev-master"
}
Then run composer update
in your terminal to pull it in.
Once this has finished, you will need to add the service provider to the providers array in your config/app.php
file as follows:
'providers' => [
// Other service providers...
Gtk\Gapi\GapiServiceProvider::class,
],
If you are using Lumen, register the Gtk\Gapi\GapiServiceProvider
in your bootstrap/app.php
file:
// $app->register(App\Providers\AppServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register(Gtk\Gapi\GapiServiceProvider::class);
Next, you are ready to response API results for your application with api_response()
helper function:
class FooController extends Controlelr
{
// some code ...
return api_response()->json([
'success' => true,
]);
}
Gapi is open-sourced software licensed under the MIT license.