Services
LicenseServiceInterface
v1.0.0License activation and status inspection for modules that depend on licensed features.
Access
$ctx->license()?->isActive();How To Use It
- Use it to gate paid features, activation flows, and support diagnostics against the runtime license state.
- Treat the returned LicenseStatus as the source of truth for plan, expiry, and feature flags instead of duplicating that state in settings.
Methods
public function getStatus(): LicenseStatusReturns the current license status DTO.
public function activate(string $key): LicenseStatusActivates a license key and returns the resulting status.
public function deactivate(): boolDeactivates the current license and reports whether the operation succeeded.
public function isActive(): boolConvenience check that reports whether the current license is active.
Example
bootstrap.php
public function activateLicense(SdkContext $ctx, string $key): void
{
$status = $ctx->license()?->activate($key);
$ctx->logger()->info('reports.license_updated', [
'status' => $status?->status,
'active' => $status?->isActive(),
]);
}