bart / licensee
基于openssl签名的许可生成和验证的简单PHP类
v1.0.0
2014-05-11 10:13 UTC
Requires
- php: >=5.3.0
- claudusd/cryptography: dev-master
- illuminate/support: 4.1.x
This package is not auto-updated.
Last update: 2024-09-24 02:44:14 UTC
README
一个简单的基于openssl签名的许可生成和验证的PHP类
用法
使用Licensee类非常简单,因为它遵循PSR-0命名空间标准。
- 将
"bart/licensee":"dev-master"
添加到您的composer.json
的require-dev
- 运行
composer update
- 享受吧!
注意:如果您在使用令人惊叹的Laravel 4框架进行开发,您可以添加一个别名: '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');
许可
Licensee包是开源软件,许可协议为MIT许可