Closed r-brown closed 3 years ago
To use NetLicensing PHP Client you need to add this library as dependency to your project.
For instance via, composer.json
:
"require": {
"Labs64/NetLicensingClient-php": "~2.4.0",
},
Recommended NetLicensing authentication option is: API Key (needed role for validate
endpoint is Licensee
). You can easily create an API Key via Management Console / Settings / API Access
Use your generated API Key number and Customer number in the PHP code snippet below:
const SECURITY_MODE = \NetLicensing\Constants::APIKEY_IDENTIFICATION;
const APIKEY = 'YOUR-API-KEY';
const LICENSEE = 'CUSTOMER-NUMBER';
try {
$context = new \NetLicensing\Context();
$context->setSecurityMode(SECURITY_MODE);
$context->setApiKey(APIKEY);
$validationParameters = new \NetLicensing\ValidationParameters();
$validationResult = \NetLicensing\LicenseeService::validate($context, LICENSEE, $validationParameters);
print_r($validationResult);
} catch (Exception $exception) {
print_r($exception->getMessage());
Resulting validationResult
contains received validation result object, which need to be interpreted in your application.
NetLicensing\ValidationResults Object
(
[validators:protected] => Array
(
[M12345678] => Array
(
[productModuleNumber] => M12345678
[valid] => true
[expires] => 2021-02-13T00:00:00Z
[productModuleName] => Module One
[licensingModel] => Subscription
)
)
[ttl:protected] => DateTime Object
(
[date] => 2020-11-20 13:32:32.682000
[timezone_type] => 2
[timezone] => Z
)
Question Vendor request
Additional context API Key: disclosed licenseeNumber: disclosed