Download the PHP package klevu/php-sdk without Composer

On this page you can find all versions of the php package klevu/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

klevu/php-sdk

The Klevu PHP-SDK is a small package designed to simplify communicating with Klevu API services.

Getting Started

  1. Create an account with Klevu.
    Free trial, with full access to all features is available.
  2. Retrieve your JS API Key and REST AUTH Key from Store Settings > Store Info in your account.
  3. Install the SDK in your application using composer.

  4. Start building!
    There are some quick-start examples below, as well as detailed guides in our developer documentation.

System Requirements

To use this library, you must be running PHP 8.1 compiled with the libxml and simplexml extensions. See the PHP docs for more information.

You will also require a PSR-18 compatible HTTP client, such as guzzlehttp/guzzle, which provides psr/http-client-implementation support. A list of compatible libraries can be found on Packagist.

We also recommend a PSR-3 compatible logger library, such as monolog/monolog. This will allow the SDK to write activity it performs to a location of your choice.

Quick Start Guide

Account Credentials

The AccountCredentials object is required by all services connecting with Klevu.
You will need both your JS API Key (in the format klevu-xxxxxxx) and your REST AUTH Key from your Klevu account.

When saving and accessing these credentials within your application, please treat the REST AUTH Key in the same manner as any other sensitive information, such as passwords.
If you need to change your REST AUTH Key, please contact our support team.

Create a new Klevu\PhpSDK\Model\AccountCredentials object. Note, account credentials objects are immutable.

Retrieving Account Details

You can find a more complete example of retrieving account information in the examples section

The AccountLookupService lets you retrieve details about your Klevu account, including hostnames required to push and pull data to other services.

Which will return an object as follows.

Each property listed is private and accessed through getters, as follows

Note, in the example above we instantiate the service implementation rather than the interface.
If you are using dependency injection, we recommend configuring the Klevu\PhpSDK\Api\Interface\Service\Account\AccountLookupService interface to Klevu\PhpSDK\Service\Account\AccountLookupService, along with any constructor arguments.
For example:

Retrieving Account Features

In the example above, the returned model's accountFeatures property is empty. In order to load your account's enabled features, you will need to invoke the AccountFeaturesService, as shown.

Which will return an immutable object as follows.

Each property is public and can be accessed directly, but not modified.

You can also attach this to your loaded account model by setting the accountFeatures property. This is not required but you may find it useful to have all data in a single model within your application.

Note: as with the previous example, we instantiated the implementation rather than the interface in our example. Again, we recommend mapping with dependency injection if your application supports this.


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1|~8.2|~8.3
ext-libxml Version *
ext-simplexml Version *
psr/log Version *
psr/http-client Version *
psr/http-message Version *
php-http/discovery Version ~1.15
linchpin/phpdocumentor-template-markdown Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package klevu/php-sdk contains the following files

Loading the files please wait ....