apitoolkit / apitoolkit-laravel
A PHP/Laravel SDK Wrapper for APIToolkit. It monitors incoming traffic, gathers the requests and sends the request to the apitoolkit servers.
Requires
- ext-curl: *
- ext-json: *
- galbar/jsonpath: ^3.0
- google/cloud-pubsub: ^1.35
- illuminate/http: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- ramsey/uuid: ^4.7
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.10
This package is auto-updated.
Last update: 2024-11-10 10:05:16 UTC
README
Laravel SDK
APItoolkit is an end-to-end API and web services management toolkit for engineers and customer support teams. To integrate your Laravel (PHP) application with APItoolkit, you need to use this SDK to monitor incoming traffic, aggregate the requests, and then deliver them to the APItoolkit's servers.
Table of Contents
Installation
Kindly run the command below to install the SDK:
composer require apitoolkit/apitoolkit-laravel
Configuration
First, add the APITOOLKIT_KEY
environment variable to your .env
file like so:
APITOOLKIT_KEY={ENTER_YOUR_API_KEY_HERE}
Next, register the middleware in the app/Http/Kernel.php
file under the correct middleware group (e.g., api
) or at the root, like so:
<?php 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 ], ]; }
Alternatively, if you want to monitor specific routes, you can register the middleware, like so:
<?php 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, ]; }
Then you can use the apitoolkit
middleware in your routes like so:
Route::get('/', function () { return response()->json([ 'message' => 'Welcome to your new application!' ]); })->middleware('apitoolkit');
Note
The {ENTER_YOUR_API_KEY_HERE}
demo string should be replaced with the API key generated from the APItoolkit dashboard.
Important
To learn more configuration options (redacting fields, error reporting, outgoing requests, etc.), please read this SDK documentation.
Contributing and Help
To contribute to the development of this SDK or request help from the community and our team, kindly do any of the following:
- Read our Contributors Guide.
- Join our community Discord Server.
- Create a new issue in this repository.
License
This repository is published under the MIT license.