---
title: Configure HTTP Transport
slug: php-sdk/configure-http-transport
docTags: 
createdAt: 2024-05-14T16:25:56.285Z
---

The PHP-SDK does not specify a dependency on any HTTP client to ensure better integration with existing systems and frameworks. Instead, the [PHP HTTP Discovery package](https://github.com/php-http/discovery) is used to allow us to detect a [compatible HTTP client](https://github.com/php-fig/http-client/blob/master/src/ClientInterface.php) where required.

::::hint{type="info"}
If your application does not already use a [PSR-18 compatible](https://www.php-fig.org/psr/psr-18/) client, you will need to install one before sending data to Klevu's APIs. We recommend using [Guzzle](https://github.com/guzzle/guzzle/), which can be installed with the following command

:::CodeblockTabs
Bash

```linux
composer install guzzlehttp/guzzle
```
:::
::::

All services which interact with Klevu's APIs accept a HTTP client instance via their constructor.

Note: *If you are integrating into a modern framework, you should implement this via your dependency injection system even if automatic discovery succeeds to ensure better stability and application performance.*

```php
<?php

declare(strict_types=1);

use GuzzleHttp\Client;
use Klevu\PhpSDK\Service\Account\AccountFeaturesService;
use Klevu\PhpSDK\Service\Account\AccountLookupService;
use Klevu\PhpSDK\Service\Account\UpdateStoreFeedUrlService;
use Klevu\PhpSDK\Service\Analytics\CollectService as AnalyticsCollectService;
use Klevu\PhpSDK\Service\Indexing\AttributesService;
use Klevu\PhpSDK\Service\Indexing\Batch\DeleteService as BatchDeleteService;
use Klevu\PhpSDK\Service\Indexing\BatchService;

$httpClient = new Client();

// Account
$accountFeatureService = new AccountFeaturesService(
    httpClient: $httpClient,
);
$accountLookupService = new AccountLookupService(
    httpClient: $httpClient,
);
$updateStoreFeedUrlService = new UpdateStoreFeedUrlService(
    httpClient: $httpClient,
);

// Analytics
$collectService = new AnalyticsCollectService(
    httpClient: $httpClient,
);

// Indexing
$attributesService = new AttributesService(
    httpClient: $httpClient,
);
$batchService = new BatchService(
    httpClient: $httpClient,
);
$batchDeleteService = new BatchDeleteService(
    httpClient: $httpClient,
);
```

