licensetorun/php-sdk
Composer 安装命令:
composer require licensetorun/php-sdk
包简介
Framework-agnostic PHP SDK for Licensetorun.com — activate, validate, swap and check updates for your licensed product. Zero dependencies.
README 文档
README
A framework-agnostic PHP client for Licensetorun.com. Zero dependencies — just PHP 8.0+, cURL and JSON. Use it in plain PHP, Symfony, Slim, a CLI, or anywhere you don't have the Laravel package.
Install
composer require licensetorun/php-sdk
Or vendor it without Composer — the SDK is two files:
require __DIR__ . '/src/LicenseResult.php'; require __DIR__ . '/src/LicenseClient.php';
Usage
use Licensetorun\LicenseSdk\LicenseClient; $license = new LicenseClient([ 'api_base' => 'https://licensetorun.com', 'product_id' => 'PRODUCT-PUBLIC-UUID', // from the product page in the dashboard 'license_key' => 'CUSTOMER-KEY', 'instance' => 'customer-instance', // optional — defaults to gethostname() ]); // Activate once (consumes a seat): $result = $license->activate(); if ($result->failed()) { exit('Activation failed: ' . $result->message()); } // Gate a feature: if ($license->isValid()) { // ...licensed feature... } // Inspect the full result: $result = $license->validate(); $result->ok(); // bool $result->error(); // e.g. "license_expired", "ip_not_allowed" $result->get('license.status');// dot-access into the response
Move a seat to a new server
$license->swap('old-server.com', 'new-server.com');
Check for updates
$update = $license->checkForUpdate('1.2.0'); if ($update->get('update_available')) { $downloadUrl = $update->get('download_url'); // short-lived signed URL }
Notes
- Every method returns a
LicenseResultand never throws on HTTP/network errors — a failed request comes back aserror() === 'network_error'. validate()is not cached here (unlike the Laravel package). Call it on a schedule or cache the result yourself (e.g. for a few hours) if you check on every request, so you don't hit the API each time.
MIT licensed.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-18