Skip to content

Software License Dongle for PHP

PHP licensing is a different problem from the rest of this list, because PHP source ships as source. If you host the application yourself you do not need a dongle. If you install it on a customer’s own server — which is exactly where PHP business software tends to live — then the customer has your code, and an encoder such as ionCube or SourceGuardian gives you a licence file, which is a file, which copies.

A dongle in the server changes that: the licence is a physical object in one machine, and it cannot be duplicated to the test system, the second site or the competitor’s rack.

$dongle = KeyNub\Dongle::open();      // first dongle found
if (!$dongle->isGenuine()) {
    throw new RuntimeException('no genuine KeyNub');
}
$dongle->sessionOpen();
$license = $dongle->recordRead('license');Code language: PHP (php)

Practical notes

The binding uses FFI, so it needs the ffi extension enabled and ffi.enable set appropriately for CLI or FPM. Check the dongle when the application boots or on a schedule rather than on every request — USB round trips are fast but not free, and a per-request check buys nothing an hourly one does not.

And the rule that matters in every language: do not branch on a boolean. Encrypt data your program genuinely needs with appEncrypt at build time and decrypt it through the dongle at run time, so removing the check leaves the program with nothing to compute rather than a working unlicensed copy.

All supported languages · Buy a KeyNub · Ask us something

KeyNub

A project of AB-Tools GmbH.
Address: Marsstraße 78 · 80335 Munich · Germany
Phone: +49 89 38898588 · Fax: +49 89 38898589
E-mail: info@keynub.com

Managing Director: Andreas Breitschopp
Commercial register HRB 202859 · Amtsgericht München (Munich local court)
VAT ID DE268720895 · Munich tax office for corporations
Grenke Bank AG · IBAN: DE49201304000060270139 · BIC: GREBDEH1XXX

Developers · Payment Methods · Shipping · Terms & Conditions · Right of Withdrawal · Privacy Policy · Legal Notice