PHP SDK

SDK 2.1.1 offline migration: configure trusted tenant public keys independently of cache files. No pins means no cached authorization. Persisted offline helpers use the configured client and re-verify the original signed token on every read. Offline setup and migration.

Device and usage operations in SDK 2.1.1: all clients can request key-only device removal using tenant slug, key and activation ID. HTTP 204 confirms removal; protected portals still require OTP/account customer flows. Usage reporting returns boolean confirmation, supports nested/empty metadata objects and normalizes quantities below 1 to 1. Java/C++ use tryMeter/try_meter for that boolean contract and retain legacy detailed meter results. Neither operation retries automatically or uses offline cache. See this SDK's README for signatures and failure handling.

Floating sessions in SDK 2.1.1: checkout and heartbeat return a failed session without credentials on network/HTTP/parse failure (RequestFailed). Business denial preserves its error code or uses FloatingDenied. Floating never uses offline cache. The new boolean TryCheckin equivalent confirms HTTP 204; legacy checkin is best effort. Method names follow this language's conventions. See the source README and SDK availability matrix before choosing a registry version.

Official SDKs

PHP SDK

SDK 2.1.1 request settings

A slow or unavailable license server must not leave your application waiting indefinitely. All eight SDKs default to a 10-second timeout for each attempt and two additional attempts for safe requests. The usual backoff is 250 milliseconds, then 500 milliseconds. This is not a single 10-second deadline for the complete operation: activation also fetches a nonce.

  • License validation, nonce/public-key retrieval and floating heartbeat may retry a network failure or HTTP 5xx response. Set the retry count to zero to disable these retries; the range is 0–5.
  • Floating checkout, activation POST, usage reporting, device removal and checkin are sent once. A lost response can follow a successful server change, so retrying these blindly can duplicate work.
  • HTTP 3xx/4xx responses and malformed successful responses do not retry. SDK-owned transports do not follow redirects, so configure the final HTTPS API address directly.

For validate/activate, branch on the server's error code when available. Otherwise HttpError means an HTTP rejection, InvalidResponse means malformed successful license/nonce evidence and RequestFailed means the network/5xx attempts were exhausted without a usable signed cache. Rejection or malformed successful evidence never becomes cached authorization. A network outage can use only a separately trusted, unexpired proof.

SDKConfiguration
PHPThe constructor takes URL, cache toggle, 10 timeout seconds, trusted keys, cache path, device ID, then 2 retries.

Timeout mechanisms follow each runtime: Python uses socket I/O timeouts; Unity delegates to its transport. Caller cancellation is separate from retry policy. Unity's default adapter disables redirects; WebGL needs Unity 2021.3 or later for that protection and fails closed on older versions. Portable .NET tests do not certify an Editor, IL2CPP or browser build. Verify your actual target before shipping.

Install SDK 2.1.1 using the SDK installation references and follow the offline migration guide when upgrading from 1.x.

Pure PHP 8.0+ client. Enable ext-curl and ext-json for online calls, and ext-openssl for offline verification. No Guzzle, no additional packages. Works with Laravel, Symfony, WordPress plugins, raw PHP scripts.

Download PHP SDK (ZIP)

Installation via Composer

SDK 2.1 Composer packaging maps the client and public result types independently. Require your application’s vendor/autoload.php; no manual SDK source-file include or client construction is needed before using a result type.

composer require permitcore/sdk:2.1.1

Or install from the downloaded source ZIP:

unzip permitcore-sdk-php.zip -d permitcore-sdk-php
# Then in composer.json add the path repository:
composer config repositories.local path ../permitcore-sdk-php
composer require permitcore/sdk:@dev

Quick start — validate

<?php
require 'vendor/autoload.php';

use PermitCore\PermitCoreClient;

$client = new PermitCoreClient('https://api.permitcore.dev');
$result = $client->validate(
    'PERMIT-XXXX-XXXX-XXXX-XXXX',
    expectedProductId: '7f3e9a2b-1c4d-4e8f-9a6b-3d2c1e0f5a8b' // Optional — reject a key issued for a different product instead of silently accepting it
);

if ($result->isValid) {
    echo 'Valid! Product: ' . $result->productName . ' (' . $result->productId . ')' . PHP_EOL;

    if ($result->hasFeature('export')) {
        enableExport();
    }
} elseif ($result->errorCode === 'WrongProduct') {
    exit('This key is for a different product: ' . $result->productId);
} else {
    exit('License invalid: ' . $result->message);
}

Activate (call once per installation)

$result = $client->activate(
    licenseKey: 'PERMIT-XXXX-XXXX-XXXX-XXXX',
    deviceId:   null,                // auto-generated HWID
    deviceName: 'Production Server',
    expectedProductId: '7f3e9a2b-1c4d-4e8f-9a6b-3d2c1e0f5a8b' // optional
);

if ($result->errorCode === 'WrongProduct') {
    exit('This key is for a different product: ' . $result->productId);
}
if (!$result->isValid) {
    exit('Activation failed: ' . $result->message);
}
// Save $result->isValid to local storage — use validate() on every subsequent launch.

Metered billing

// Record a single event
$client->meter('PERMIT-XXXX-XXXX-XXXX-XXXX', 'api_call');

// Record bulk usage with metadata
$client->meter(
    licenseKey: 'PERMIT-XXXX-XXXX-XXXX-XXXX',
    eventName:  'export',
    quantity:   5,
    meta:       ['format' => 'pdf', 'pages' => 12]
);

Floating licenses

// Check out a seat at session start
$session = $client->checkout('PERMIT-XXXX-XXXX-XXXX-XXXX');
if (!$session->success) {
    exit('No seats available: ' . $session->message);
}
$token = $session->sessionToken;

// Heartbeat every 4–5 minutes (use a cron job or event loop)
$client->heartbeat($token);

// Release when the user logs out or the session ends
$client->checkin($token);

Offline grace period

$result = $client->validate($licenseKey); // falls back to disk cache automatically

if ($result->isOffline) {
    // Running on cached result — server unreachable
    showNotice('Running offline. Connect to refresh your license.');
}

LicenseResult properties

PropertyTypeDescription
isValidboolTrue if the license is active and valid
productName?stringProduct the license belongs to
remainingActivations?intActivation slots remaining
expiresAt?stringISO 8601 expiry date, null = perpetual
features?arrayFeature flag list, e.g. ['export','api']
isTrialboolTrue for trial licenses
trialDaysRemaining?intDays until trial expires
nodeLockedboolTrue if bound to a specific device
offlineGraceDays?intHow many days the cache remains valid
minVersion?stringMinimum app version the license allows
maxVersion?stringMaximum app version the license allows
vendorWarning?stringNon-fatal message from the vendor
message?stringReason when isValid = false
isOfflineboolTrue when result came from local cache
productId?stringStable ID of the product this license belongs to. Always present when a license was found, even without passing expectedProductId.

hasFeature(string $feature): bool — case-insensitive check whether a feature flag is present on the license.

Product scoping: by default, any active key belonging to your tenant validates/activates successfully regardless of which product it was issued for. If you sell more than one product, either check $result->productId yourself, or pass the optional $expectedProductId parameter and let the server reject a mismatch ($result->errorCode === 'WrongProduct'). Find a product's ID in the Admin panel under Products.