fittinq/symfony-istia

There is no license information available for the latest version (1.2.2) of this package.

1.2.2 2024-11-11 14:53 UTC

This package is auto-updated.

Last update: 2024-11-11 13:57:47 UTC


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:

  1. 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);
    
  2. 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=