Search by

lman / sdk

tggl

PHP client for the LicenseManager API: products, policies, customers, licenses, machines and releases.

v0.1.1 2026-10-20 14:38 UTC

This package is not auto-updated.

Last update: 2026-10-21 09:54:22 UTC


README

Packagist version PHP version Packagist downloads License Documentation

The official PHP SDK for the LicenseManager API: issue, manage and validate software licenses. Built on Guzzle, with a model class for each schema.

Documentation · API reference · Changelog

Requirements

PHP 8.1 or later.

Installation

composer require lman/sdk

Usage

Create an API key in the LicenseManager app, then create a license after a sale:

<?php

require __DIR__ . "/vendor/autoload.php";

use LicenseManager\Api\LicensesApi;
use LicenseManager\Configuration;
use LicenseManager\Model\CreateLicense;

$config = (new Configuration())
    ->setApiKey("x-api-key", getenv("LICENSEMANAGER_API_KEY"));
$licenses = new LicensesApi(config: $config);

$license = $licenses->createLicense("x7Kp2QaZ", new CreateLicense([
    "email" => "jane@example.com",
]));

And validate it from your application, which needs no API key:

<?php

require __DIR__ . "/vendor/autoload.php";

use LicenseManager\Api\LicensesApi;
use LicenseManager\Model\ValidateKey;

$licenses = new LicensesApi();

$licenseToken = $licenses->validateKey("x7Kp2QaZ", new ValidateKey([
    "key" => "7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF",
    "fingerprint" => "4c:32:75:8f:9a:1e",
    "version" => "1.4.2",
]));

Authentication

Most endpoints take an organization API key: keep it on your servers. The endpoints your application calls directly, like validating a key, take no credentials or a token scoped to a customer, license or machine. See authentication and scoped tokens.

use LicenseManager\Configuration;

// With an API key, from your backend:
$config = (new Configuration())->setApiKey("x-api-key", getenv("LICENSEMANAGER_API_KEY"));
// Or with a token scoped to a customer, license or machine:
$config = (new Configuration())->setAccessToken($token);

Errors

Failed requests answer an error with a stable code to branch on, listed for each endpoint in the API reference. See errors.

use LicenseManager\ApiException;

try {
    $licenses->getLicense("l3Nv8KwB");
} catch (ApiException $error) {
    // The body is { "error": { "code", "message" } }.
    echo $error->getCode(), " ", $error->getResponseBody();
}

Reference

Every method is documented, with its parameters and responses, in the docs folder:

Class Methods
LicensesApi validateKey, listLicenses, createLicense, listCustomerLicenses, getLicense, deleteLicense, updateLicense, getLicenseStats, sendLicenseKeys, getSigningKey
PortalApi getPortal, requestPortalLink, createPortalLink, sendPortalLink
ProductsApi listProducts, createProduct, getProduct, deleteProduct, updateProduct, resetProduct, uploadProductLogo, deleteProductLogo, getProductStats
PoliciesApi listPolicies, createPolicy, getPolicy, deletePolicy, updatePolicy
CustomersApi listCustomers, createCustomer, getCustomer, deleteCustomer, updateCustomer
MachinesApi listMachines, getMachine, deactivateMachine
ReleasesApi listReleases, createRelease, getRelease, deleteRelease, updateRelease
TokensApi createCustomerToken, createLicenseToken, createMachineToken
EventsApi listPolicyEvents, listLicenseEvents
IntegrationsApi getStripeIntegration, connectStripe, disconnectIntegration, checkIntegration, listStripePrices, createStripeMapping, deleteStripeMapping, updateStripeMapping

Versioning

This SDK follows semantic versioning and is generated from the OpenAPI document of the API: each release is listed in the changelog. Please don't open pull requests, they would be overwritten by the next release: open an issue instead.

License

See LICENSE.