License Activation
After purchasing the product, you should activate license for used components. There are several ways of license key connection.
To activate from a code string, simply copy the encrypted license text from your personal account on the website and register it using the static function setPrimaryKey(), which is located in the StiLicense class:
index.php |
<?php use Stimulsoft\StiLicense;
StiLicense::setPrimaryKey('Your activation code...'); ?>
|
The full example code is available on GitHub.
To activate using a license file, download the license.key file from your personal account on the website, copy it into your PHP project folder, and register it using the static function setPrimaryFile(), located in the StiLicense class:
index.php |
<?php use Stimulsoft\StiLicense;
StiLicense::setPrimaryFile('license.key'); ?>
|
The full example code is available on GitHub.
Activation of the report generator only
In some cases, you may need to activate the report generator separately from other components. In this case, the license key can be registered using the setKey() or setFile() method of the license property of the report object:
index.php |
<?php use Stimulsoft\Report\StiReport;
$report = new StiReport(); $report->license->setKey('Your activation code...'); $report->license->setFile('license.key'); ?>
|
The full example code is available on GitHub.
Protection against license key theft
If the license is activated using a code string, it can be added conditionally. For example, you may want to add the license key only for registered users:
index.php |
<?php use Stimulsoft\StiLicense; if (!empty($sessionID)) StiLicense::setPrimaryFile('Your activation code...'); ?>
|
Also, we recommend you change the location and name of the license key file, for example:
license.php |
<?php use Stimulsoft\Report\StiReport; $report->license->setFile('private/a15fc0ef64e6.key'); ?>
|