Examples / How To

Configure HTTP Transport

1min

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 is used to allow us to detect a compatible HTTP client where required.

If your application does not already use a PSR-18 compatible client, you will need to install one before sending data to Klevu's APIs. We recommend using Guzzle, which can be installed with the following command

Bash


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