PHP Classes

File: examples/

Recommend this page to a friend!
  Classes of PHPLicengine   PHPLicengine API   examples/   Download  
File: examples/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHPLicengine API
Send HTTP requests to call REST Web service APIs
Author: By
Last change:
Date: 5 years ago
Size: 1,231 bytes


Class file image Download

All API URLs listed here must be prefixed by the root API URL, such as

Service class:

$base_url = ""; // no trailing slash!
$api = new \PHPLicengine\Service\Product($base_url, $api_key);

GET /product/{product_id} - Get Product Info by id (v2.2.1)


Service method:

$response = $api->getProductById(1);


use PHPLicengine\Service\Product;
$base_url = ""; // no trailing slash!
$api_key = "API key goes here";
try {
     $api = new Product ($base_url, $api_key);
     $response = $api->getProductById(1);
     if ($response->isError()) { // if response of api has error
     } else {
         // $dataAsObject = $response->getDecodedJson();
         // echo $dataAsObject->productName;
         // echo $response->getReference();
} catch (\Exception $e) {
     echo $e->getMessage();

GET /product/name/{name} - Get Product Info by name (v2.2.1)

Service method:

$response = $api->getProductByName($name);