Retrieving Plesk License Information

One of the tasks the extension developers face is retrieving the data about the Plesk license keys installed on the server. To make it easy for an extension to obtain the Plesk license key information, the pm_License class was introduced in Plesk 12.5.

The pm_License class enables the retrieval of the main and add-on Plesk license keys, as well as retrieval of the list of all add-on keys with the ability to filter by the product name. Some usage examples are provided below:

Creating a new main license key object:
$license = new pm_License();
Creating a new add-on license key object:
$keyNumber = 'APS.02960584.0008';
$license = new pm_License($keyNumber);
Retrieving the values of all license key properties:
$license->getProperties();
Retrieving the value of a license key property with a specific name:
$license->getProperty('security-core');
Retrieving the list of all add-on keys:
pm_License::getAdditionalKeysList();
Retrieving the list of all add-on keys with a specific product name:
$productName = 'security-core-with-atomicorp-modsecurity-rules';
pm_License::getAdditionalKeysList($productName);