Download the PHP package code-heaven/license-sdk without Composer

On this page you can find all versions of the php package code-heaven/license-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package license-sdk

Code Heaven License SDK (PHP)

Vendor SDK for the Code Heaven Developer License API. Use it inside your plugin/theme/app to validate licenses, activate and free domain seats, check for updates, and fetch signed download URLs.

This is the vendor server-to-server flow. Authentication is a single vendor API key (X-CH-Vendor-Key), not the buyer OAuth flow.

Install

Quick start: validate and gate

validate() returns the decoded API body plus two SDK markers:

key meaning
valid bool
status valid | invalid | expired | domain_not_activated | revoked
product product slug (or null)
expiresAt ISO 8601 string or null
activations [{domain, activatedAt}, ...]
seatLimit int
_cached present & true when served from cache
_offline present & true when served from cache during an outage

Activate a seat on first run

When validate() returns domain_not_activated (a LicenseException with apiCode === 'domain_not_activated'), claim a seat:

Check for and apply an update

Free the seat on uninstall

Caching and offline grace

validate() is cached so repeated calls in one request never hit the wire twice, and the result persists across requests when you supply a persistent cache:

Persistent caches:

The default is an in-process ArrayCache (no cross-request persistence, so no offline grace across requests — supply FileCache/TransientCache in production).

Custom HTTP transport (WordPress, Guzzle, …)

Inject any callable as http. It receives (method, url, headers, ?body) and must return ['status' => int, 'headers' => array, 'body' => string], or throw TransportException on a connection failure (which triggers offline grace).

See examples/gate-plugin.php for a complete, fail-safe WordPress gate (validate → activate-on-first-run → admin nag → deactivate-on-uninstall).

Exceptions

All extend CodeHeaven\License\CodeHeavenException and expose ->statusCode, ->apiCode, ->response.

Exception HTTP When
AuthException 401 Vendor key missing/invalid (your packaging bug)
LicenseException 403 license_invalid / expired / domain_not_activated
SeatLimitException 409 seat_limit_exceeded on activateDomain()
RateLimitException 429 Rate limited (->retryAfter holds the hint, if any)
TransportException — API unreachable and no usable cached result
CodeHeavenException 4xx/5xx Any other non-2xx response

Note: an invalid or expired license that the API reports with HTTP 200 and valid:false is returned as data, not thrown. The API only throws LicenseException for the 403 cases above.

Development

License

MIT.


All versions of license-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package code-heaven/license-sdk contains the following files

Loading the files please wait ...