1. Go to this page and download the library: Download cboxdk/license 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/ */
cboxdk / license example snippets
JWT::decode($licenseKey, new Key($this->publicKeyBase64, 'EdDSA'));
use Cbox\License\Support\Ed25519KeyPair;
$keys = Ed25519KeyPair::generate();
// $keys['privateKey'] stays on the issuer; $keys['publicKey'] ships with verifiers.
use Cbox\License\Ed25519LicenseIssuer;
use Cbox\License\ValueObjects\{LicenseRequest, LicenseLimits};
use Cbox\License\Capabilities;
$issuer = new Ed25519LicenseIssuer($privateKeyBase64);
$licenseKey = $issuer->issue(new LicenseRequest(
plan: 'enterprise',
entitlements: [Capabilities::SSO, Capabilities::SAML, Capabilities::ANALYTICS],
limits: new LicenseLimits(organizations: 10, seats: 500, environments: null),
customerId: 'cus_ACME',
deploymentId: 'dep_ACME_PRIMARY',
licensedDomain: 'id.acme.example', // or null to leave domain-unbound
issuedAt: new DateTimeImmutable('now'),
notBefore: new DateTimeImmutable('now'),
expiresAt: new DateTimeImmutable('+1 year'),
));
use Cbox\License\Ed25519LicenseVerifier;
use Cbox\License\ValueObjects\VerificationContext;
$verifier = new Ed25519LicenseVerifier(
publicKeyBase64: $publicKeyBase64,
graceSeconds: 7 * 24 * 3600, // keep serving for a week past expiry
clockSkewSeconds: 60,
);
$result = $verifier->verify($licenseKey, new VerificationContext(
deploymentId: 'dep_ACME_PRIMARY',
domain: 'id.acme.example',
now: new DateTimeImmutable('now'),
revocations: $revocationList, // optional; null = no revocation check
));
if ($result->isLicensed()) {
$entitlements = $result->entitlements(); // list<string>, empty unless licensed
$limits = $result->limits(); // LicenseLimits|null
}
// Otherwise inspect $result->status (an enum) and $result->reason (operator text).
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.