1. Go to this page and download the library: Download getkeymanager/php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
getkeymanager / php-sdk example snippets
use GetKeyManager\SDK\Validation\LicenseValidator;
// $validator is the LicenseValidator instance (used internally by LicenseClient)
$licenseData = $validator->parseLicenseFile($licFileContent, $publicKey);
if ($validator->isForceValidationPast($licPath, $keyPath)) {
showLicenseScreen();
die("License validation
// Clear all cache
$client->clearCache();
// Clear cache for specific license
$client->clearLicenseCache('XXXXX-XXXXX-XXXXX-XXXXX');
use GetKeyManager\SDK\SignatureVerifier;
$verifier = new SignatureVerifier($publicKeyPem);
$data = '{"license":"XXXXX-XXXXX-XXXXX-XXXXX"}';
$signature = 'base64_encoded_signature';
if ($verifier->verify($data, $signature)) {
echo "Signature is valid!\n";
} else {
echo "Signature verification failed!\n";
}
$jsonResponse = '{"data":{},"signature":"..."}';
if ($verifier->verifyJsonResponse($jsonResponse)) {
echo "Response signature is valid!\n";
}
$idempotencyKey = '550e8400-e29b-41d4-a716-446655440000';
$result = $client->activateLicense($licenseKey, [
'hardwareId' => $hardwareId,
'idempotencyKey' => $idempotencyKey
]);
// Repeat with same key will return same response
$result2 = $client->activateLicense($licenseKey, [
'hardwareId' => $hardwareId,
'idempotencyKey' => $idempotencyKey
]);
// ❌ Don't hardcode API keys
$client = new LicenseClient(['apiKey' => 'pk_live_...']);
// ✅ Use environment variables
$client = new LicenseClient(['apiKey' => getenv('LICENSE_API_KEY')]);
// Generate once and store
$hardwareId = $client->generateHardwareId();
file_put_contents('/var/app/hwid.txt', $hardwareId);
// Reuse stored value
$hardwareId = file_get_contents('/var/app/hwid.txt');
try {
$result = $client->validateLicense($licenseKey);
} catch (NetworkException $e) {
// Fall back to offline validation
$offlineLicense = file_get_contents('/var/app/offline-license.json');
$result = $client->validateOfflineLicense($offlineLicense);
}