PHPackages                             digital-nature/licence-verifier - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. digital-nature/licence-verifier

ActiveLibrary[API Development](/categories/api)

digital-nature/licence-verifier
===============================

PHP client for the Digital Nature licence verification API

v0.2.1(1mo ago)077MITPHPPHP &gt;=7.4CI passing

Since May 22Pushed 1mo agoCompare

[ Source](https://github.com/Digital-Nature-LTD/software.digital-nature.co.uk-licence-verifier-php)[ Packagist](https://packagist.org/packages/digital-nature/licence-verifier)[ RSS](/packages/digital-nature-licence-verifier/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (10)Versions (5)Used By (0)

digital-nature/licence-verifier
===============================

[](#digital-naturelicence-verifier)

PHP client for the [Digital Nature](https://digital-nature.co.uk) licence verification API. Requires PHP 7.4+.

Installation
------------

[](#installation)

```
composer require digital-nature/licence-verifier
```

You also need a [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client and [PSR-17](https://www.php-fig.org/psr/psr-17/) factories. With Guzzle:

```
composer require guzzlehttp/guzzle nyholm/psr7
```

Usage
-----

[](#usage)

```
use DigitalNature\LicenceVerifier\LicenceVerifier;
use GuzzleHttp\Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$factory  = new Psr17Factory();
$verifier = new LicenceVerifier(
    'https://verify.software.digital-nature.co.uk',
    new Client(),   // PSR-18 client
    $factory,       // PSR-17 request factory
    $factory,       // PSR-17 stream factory
);

// Check a licence is valid
$result = $verifier->verify('XXXX-XXXX-XXXX-XXXX');
// $result->valid, ->licenceKey, ->productSlug, ->status, ->expiresAt

// Activate a domain
$activation = $verifier->activate('XXXX-XXXX-XXXX-XXXX', 'example.com');
// $activation->activated, ->domain, ->domainType, ->activationsUsed, ->activationLimit

// Deactivate a domain
$verifier->deactivate('XXXX-XXXX-XXXX-XXXX', 'example.com');

// Get full licence info
$info = $verifier->info('XXXX-XXXX-XXXX-XXXX');
// $info->licenceKey, ->productSlug, ->status, ->activationsUsed, ->activationLimit, ->domains[]
```

Options
-------

[](#options)

The fifth constructor argument is `$cacheTtl` in milliseconds (default `30000`). Responses from `verify()` and `info()` are cached in-process for the duration of the request. Set to `0` to disable.

> **Note:** PHP-FPM processes are request-scoped, so the cache only persists within a single HTTP request. It avoids redundant calls when `verify()` is called multiple times in one execution.

Error handling
--------------

[](#error-handling)

All methods throw typed exceptions that extend `LicenceVerifierException`:

```
use DigitalNature\LicenceVerifier\Exception\ActivationLimitReachedException;
use DigitalNature\LicenceVerifier\Exception\DomainAlreadyActiveException;
use DigitalNature\LicenceVerifier\Exception\LicenceExpiredException;
use DigitalNature\LicenceVerifier\Exception\LicenceInactiveException;
use DigitalNature\LicenceVerifier\Exception\LicenceNotFoundException;
use DigitalNature\LicenceVerifier\Exception\LicenceVerifierException;

try {
    $verifier->activate($key, $domain);
} catch (ActivationLimitReachedException $e) {
    // limit reached
} catch (LicenceNotFoundException $e) {
    // key doesn't exist
} catch (LicenceVerifierException $e) {
    // catch-all
}
```

WordPress plugin auto-updates
-----------------------------

[](#wordpress-plugin-auto-updates)

`WordPress\Updater` hooks a plugin into the WordPress update system so that new versions published to the Digital Nature store appear in **Dashboard → Updates** and can be installed with one click.

### Installation

[](#installation-1)

Include the library in your plugin's `composer.json` alongside a PSR-18 client:

```
composer require digital-nature/licence-verifier guzzlehttp/guzzle nyholm/psr7
```

Load Composer's autoloader from your plugin's main file (if not already done by the plugin framework):

```
require_once __DIR__ . '/vendor/autoload.php';
```

### Setup

[](#setup)

Instantiate `Updater` once, early in your plugin's boot sequence (e.g. directly in the main plugin file or on the `init` hook):

```
use DigitalNature\LicenceVerifier\LicenceVerifier;
use DigitalNature\LicenceVerifier\WordPress\Updater;
use GuzzleHttp\Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$factory  = new Psr17Factory();
$verifier = new LicenceVerifier(
    'https://verify.software.digital-nature.co.uk',
    new Client(),
    $factory,
    $factory,
);

new Updater(
    __FILE__,                                 // absolute path to the plugin's main file
    'my-plugin/my-plugin.php',                // plugin slug (directory/filename.php)
    get_option('my_plugin_licence_key', ''),  // stored licence key
    $verifier,
    [
        'requires_php' => '7.4',  // minimum PHP version shown in the update UI
        'requires_wp'  => '6.0',  // minimum WordPress version
        'tested'       => '6.8',  // tested up to (shown in the update UI)
        'cache_hours'  => 12,     // how long to cache the update check (default: 12)
    ]
);
```

The constructor registers all required WordPress hooks automatically — no further wiring is needed.

### How it works

[](#how-it-works)

WordPress hookWhat it does`pre_set_site_transient_update_plugins`Checks for a newer version and injects it into the WP update transient`plugins_api`Supplies plugin name, version, and changelog for the "View version details" modal`upgrader_process_complete`Clears the cached update info after the plugin is updatedUpdate checks are cached in WordPress transients for `cache_hours` to avoid hitting the API on every page load. The download URL passed to WordPress never expires — the verify service validates the licence key on each download request.

Errors (invalid licence, expired licence, network failure) are silently swallowed so they never break the WordPress admin.

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- PSR-18 HTTP client
- PSR-17 request and stream factories

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance90

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

3

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6b41ce3e69067999d1379085fb6390cf35e5d61929aa49d72363d79e4890bb1?d=identicon)[gmidwood](/maintainers/gmidwood)

---

Top Contributors

[![garethmidwood](https://avatars.githubusercontent.com/u/4386083?v=4)](https://github.com/garethmidwood "garethmidwood (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/digital-nature-licence-verifier/health.svg)

```
[![Health](https://phpackages.com/badges/digital-nature-licence-verifier/health.svg)](https://phpackages.com/packages/digital-nature-licence-verifier)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36789.4k2](/packages/telnyx-telnyx-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60316.0M89](/packages/mollie-mollie-api-php)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

486.3k](/packages/bushlanov-dev-max-bot-api-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
