PHP 应用程序分发许可

安装: 420

依赖项: 1

建议者: 0

安全: 0

星标: 36

关注者: 7

分支: 30

开放问题: 2

类型:项目

v1.1.1 2016-09-03 03:49 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:53:15 UTC


README

什么是PADL

一个用于生成和验证域许可证的类,限制过期日期。

演示和API

历史

PADL最初于2005年由Oliver Lillie编写,在旧PHP4下运行,停放在PHPCLASSES网站上。您可以在本分布的原始代码中找到它,或者在PHP-Generate-PHP-application-license-keys中直接找到。

您可以在以下内容中看到关于

There are several solutions to help developers protecting the PHP software
of applications that they want to sell.

Usually the developers provide license keys with their software
that include information about the licensed code, enabled features,
authorized configuration of the environment on which it is being installed.

This helps the developers to limit the scope of usage of their
software according to the type of software license that their clients purchase.

This way the developers can use the same software distribution
for different configurations and prices and even trial versions.

This class provides a means to generate license keys that include encrypted
information about the clients PHP environment and even a way to send the keys
to the developers site so they can capture the client features and generate
upgraded keys that can enable more features for clients that pay the upgrade price.

Manuel Lemos (PHPCLASSES manteiner)

当我需要为PHP项目许可时,发现了这个类,由于它写得很好,很容易更新到PH 5.2和5.3。

您可以在以下内容中找到关于原始作者更多信息

待办事项

尚未实现验证服务器 - 代码尚未转换为PHP 5.2和5.3 - 但实际上可以通过Web服务轻松实现。

安装

composer require rafaelgou/padl

使用方法

examples目录下有许多基本使用的示例。在Web服务器上运行这些示例。

要测试localhost,请使用参数allowLocal=True

要生成和验证许可证,代码必须在待验证的域下运行

您可以将许可证存储在文件、数据库中,甚至远程存储。

生成

<?php
/*
Instance of License
parameters:
- useMcrypt
- useTime
- useServer
- allowLocal
*/
$padl = new Padl\License(true, true, true, true);

//For better security injecting a copy of $_SERVER global var
$server_array = $_SERVER;
$padl->setServerVars($server_array);

$date_expire = '12/31/2011';
list($month, $day, $year) = explode($date_expire);
// Calculating the time offset (expire_in)
$now       = mktime(date('H'), date('i'), date('s'), date('m'), date('d') , date('Y'));
$dateLimit = mktime(23, 59, 59, $month, $day, $year);
$expireIn  = $dateLimit - $now;

// Generating a key with your server details
$license = $padl->generate('localhost', 0, $expire_in);

// Save the license anywhere, database, filesystem, even remotely

验证

<?php
/*
Instance of License
parameters used in this sample:
- useMcrypt  = false
- useTime    = true
- useServer  = false
- allowLocal = true
*/
$padl = new PadlLicense(true, true, true, true);

// For better security injecting a copy of $_SERVER global var
$server_array = $_SERVER;
$padl->setServerVars($server_array);

// get the license from a form, or load from database, filesystem
$license = (... load the license ...);

// the set key is the key validated
$results = $padl->validate($license);