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 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 declare(strict types=1); use guzzlehttpclient; 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, );