PHP code example of apitoolkit / apitoolkit-laravel

1. Go to this page and download the library: Download apitoolkit/apitoolkit-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apitoolkit / apitoolkit-laravel example snippets




namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $middlewareGroups = [
        'api' => [
            // Other middleware here...
            \APIToolkit\Http\Middleware\APIToolkit::class, // Initialize the APItoolkit client
        ],
    ];
}



namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        // Other middleware here...
        'apitoolkit' => \APIToolkit\Http\Middleware\APIToolkit::class,
    ];
}

Route::get('/', function () {
    return response()->json([
        'message' => 'Welcome to your new application!'
    ]);
})->middleware('apitoolkit');