Guide
Technical / Architecture
Dependencies and Auto-Discovery
4min
the php sdk is designed to be as interoperable as possible as such, dependencies on third party libraries especially where alternatives exist is kept to a minimum, and required versions kept as loose as possible existing dependencies package details php all currently maintained (including security support) php versions are supported ext libxml ext simplexml xml handling libraries are required to process the response payload of some klevu apis psr/log allows hooking in psr 3 compliant logging psr/http client psr/http message allows hooking in psr 17 compliant http factories and psr 18 compliant http clients to communicate with klevu apis php http/discovery provides auto discovery functionality for compatible http clients and factories already installed in your application auto discovery http client, request and response factories in order to reduce installation time in applications which already have a psr 18 compliant http client, such as guzzle, any class which needs to communicate with the klevu apis will attempt to automatically discover a suitable client for transport this action occurs during object instantiation and will throw an exception if a class cannot be found if your application uses a non psr 18 compliant library or php's curl functions directly, you will need to install or create a client which implements psr\httpclient\clientinterface and ensure they are available to your autoloader the http discovery package will also attempt to locate factory classes responsible for creating psr 17 compliant request and response objects if your application does not contain these factories, you will need to install or create classes which implement psr\httpmessage\requestfactoryinterface and psr\httpmessage\responsefactoryinterface and ensure they are available to your autoloader if automatic discovery cannot locate implementations of any of the above classes, or you wish to use a different class to the one found, all service classes will allow injection of the relevant classes through the constructor for more information and examples, please see the configure http transport docid\ waa8uvhybj om0cyk00ea how to article logging as logging is not an integral component of the sdk, it will not attempt auto discovery for implementations of psr\log\loggerinterface in this scenario, no errors will be raised logging will be silently skipped to enable logging, you should install or create an implementation of a psr 3 compliant logger and inject it manually into the applicable classes for more information and examples, please see the logging docid\ he6hsiam09adhe9f0insh how to article