Drivers
The HTTP Driver
Introduction
The HTTP driver uses Laravel's excellent illuminate/http library to expose an API client within Kipchak.
Installation
Install the driver via composer by running:
composer require kipchak/driver-http
Initialise the Driver
Add the following line to your drivers/drivers.php file:
\Mamluk\Kipchak\Driver\Http\Http::iniitalise($container);
Configuration
This driver has no configuration.
Usage
use Kipchak\Driver\Http\Http;
$client = Http::get();
$response = $client->get('https://api.example.com/data');
Access parts of the response using:
$response->body() : string;
$response->json($key = null, $default = null) : mixed;
$response->object() : object;
$response->collect($key = null) : Illuminate\Support\Collection;
$response->resource() : resource;
$response->status() : int;
$response->successful() : bool;
$response->redirect(): bool;
$response->failed() : bool;
$response->clientError() : bool;
$response->header($header) : string;
$response->headers() : array;
For more details, see the Laravel HTTP Client documentation at https://laravel.com/docs/12.x/http-client.
Git Repository
The source code for this driver is available on 1x.ax at https://1x.ax/mamluk/kipchak/drivers/http.