A RESTful API package for the Laravel and Lumen frameworks.

v0.2.0 2019-03-06 10:05 UTC

This package is not auto-updated.

Last update: 2022-08-06 08:16:00 UTC


Build Status Latest Stable Version Total Downloads License

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...


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);

Basic Usage

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.