A simple PHP class for license generation and verification based on openssl signatures
Using the Licensee class is as easy as pie, because it follows the PSR-0 namespace standard.
- Add
"bart/licensee":"dev-master"
to yourcomposer.json
require-dev
- Run
composer update
- Enjoy!
Note: If you developing with the amazing Laravel 4 framework, you can add an alias: 'License' => 'Bart\Licensee\License'
createLicense($data, $private_key_path, [$license_path])
storeLicense($license_path)
validateLicense($license_path, $public_key_path)
getDataAndValidateLicense($license_path, $public_key_path)
createKeypair([$private_key_path], [$public_key_path])
$lic = new License();
// The array we want to create a license from
$data = array(
'licensee' => 'Company name',
'version' => '1.0',
'valid_until' => time() + 60*60*24,
'key' => sha1(uniqid(true))
);
// Create a new public and private key
$lic::createKeypair('/tmp/private.pem', '/tmp/public.pem');
// Create the license
$lic->createLicense($data, '/tmp/private.pem', '/tmp/license.lic');
// Validate the license and get the data back
$valid_data = $lic->getDataAndValidateLicense('/tmp/license.lic', '/tmp/public.pem');
The Licensee package is open-sourced software licensed under the MIT license