digitea / licensing
Digitea Runtime licensing SDK
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- phpunit/phpunit: ^10.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official PHP client for the Digitea Runtime Licensing API.
The public facade is Digitea\\Licensing\\DigiteaLicensing. The OpenAPI-generated transport under generated/ is an implementation detail.
Installation
composer require digitea/licensing:^1.2.3
Quick start
use Digitea\\Licensing\\DigiteaLicensing;
$client = new DigiteaLicensing(
'prd_example123',
'https://api.getdigitea.com',
'stable-installation-id',
null,
10.0,
2
);
$activation = $client->activate(
'dgt_lic_example',
'stable-installation-id',
'Customer workstation'
);
if ($activation->getValid() && $activation->getStatus() === 'ACTIVE') {
start_application();
}
Complete lifecycle
$validation = $client->validate($licenseKey, 'stable-installation-id');
if ($validation->getValid() && $validation->getStatus() === 'ACTIVE') {
enable_licensed_features();
}
$deactivation = $client->deactivate($licenseKey, 'stable-installation-id');
Renewal session and idempotency
$renewal = $client->createRenewalSession(
$licenseKey,
"stable-installation-id",
"renewal-operation-123",
"https://software.example.com/license-renewal"
);
open_in_browser($renewal->getCheckoutUrl());
// Run after the browser returns; the redirect is not proof of payment.
$renewalStatus = $client->getRenewalSessionStatus(
$licenseKey,
$renewal->getRenewalSessionId(),
"stable-installation-id"
);
if ($renewalStatus->getStatus() === "PAID") {
$validation = $client->validate($licenseKey, "stable-installation-id");
}
The PHP SDK accepts returnUrl as the fourth argument of createRenewalSession and exposes getRenewalSessionStatus.
Reuse the same third argument, idempotencyKey, when retrying the same logical renewal operation. If omitted, the SDK generates a valid key and reuses it across HTTP retries.
Configuration and errors
The constructor accepts productId, baseUrl, instanceId, instanceStore, timeout and retries.
use Digitea\\Licensing\\DigiteaError;
try {
$result = $client->validate($licenseKey);
} catch (DigiteaError $error) {
if ($error->errorCode === 'LICENSE_EXPIRED') {
show_renewal_screen();
}
}
Runtime calls use only product, license and installation identifiers. Temporary network, rate-limit and server failures are retried.
Security
Never embed a Developer API key, webhook secret or server credential in distributed PHP software. Never log a license key. Use HTTPS in production.
The same five operations are available in every Runtime SDK:
activate()validate()deactivate()createRenewalSession()getRenewalSessionStatus()
Repository: https://github.com/getdigitea/Digitea