fittinq / symfony-istia
Requires
- fittinq/symfony-connector: ^21.0
- symfony/framework-bundle: ^6.1
- symfony/http-client: ^6.1
Requires (Dev)
- fittinq/symfony-mock: ^4.4
- phpunit/phpunit: ^9.5
- symfony/yaml: ^6.1
README
The Symfony Istia HTTP Client, IstiaHttpClient
, is designed to simplify HTTP requests to Istia services with added headers and authentication.
Table of Contents
Introduction
The IstiaHttpClient
class is a Symfony component that enhances the standard Symfony HttpClient.
It adds headers, authentication credentials, and custom options for making requests to Istia services.
Installation
To use the Symfony Istia HTTP Client in your project, you can include it via Composer.
composer require fittinq/symfony-istia
Usage
To use the IstiaHttpClient, follow these steps:
Create an instance of the IstiaHttpClient class, providing it with the required dependencies: HttpClientInterface, username, password, and API key.
use Fittinq\Symfony\Istia\IstiaHttpClient; use Symfony\Contracts\HttpClient\HttpClientInterface; $httpClient = new HttpClient(); // Replace with your actual HttpClient instance. $username = '%env(ISTIA_USERNAME)%'; $password = '%env(ISTIA_PASSWORD)%'; $apiKey = '%env(ISTIA_API_KEY)%'; $istiaHttpClient = new IstiaHttpClient($httpClient, $username, $password, $apiKey);
You can use the request method to send HTTP requests to Istia services. It automatically adds headers for Content-Type, login, password, and apiKey.
$url = 'https://istia-service-url'; $options = ['headers' => ['custom-header' => 'value']]; $response = $istiaHttpClient->request('GET', $url, $options);
Configuration
Add the following parameters to your environment
ISTIA_USERNAME=
ISTIA_PASSWORD=
ISTIA_API_KEY=