Recommend this page to a friend! |
Classes of Josantonius | PHP License System | README.md | Download |
|
DownloadLicense Handler · Eliasis PHP Framework pluginLicensing and applications manager.
RequirementsThis plugin is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher. InstallationThe preferred way to install this extension is through Composer. To install License Handler, simply:
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
You can also clone the complete repository with Git:
Available MethodsAvailable methods in this plugin: Applications- Add application:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $name | Application name. | string | Yes | | $type | Application type. | string | Yes | | $category | Application category. | string | Yes | | $active | Application state. | boolean| Yes | @return (int) ? Application inserted ID. - Update application:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $id | Application ID. | string | Yes | | $name | Application name. | string | Yes | | $type | Application type. | string | Yes | | $category | Application category. | string | Yes | | $active | Application state. | boolean| Yes | @return (int) ? Rows affected. Sites- Add site:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $domain | Site domain. | string | Yes | | $host | Site host. | string | Yes | | $ip | Site ip. | string | Yes | | $authorized | Authorized?. | boolean| Yes | @return (int) ? Site inserted ID. - Update site:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $id | Site ID. | string | Yes | | $domain | Site domain. | string | Yes | | $host | Site host. | string | Yes | | $ip | Site ip. | string | Yes | | $authorized | Authorized?. | boolean| Yes | @return (int) ? Rows affected. License- Generate license key:
| Atttribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $characters | Characters number by segments. | int | No | 5 | | $segments | Segments number. | int | No | 5 | @return (string) ? License key. - Add license:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $appID | Application table id. | int | Yes | | $siteID | Site table id. | int | Yes | | $key | License key. | string | Yes | | $state | License state. | bool | Yes | | $expire | License expiration date. | string| Yes | @return (int) ? License inserted ID. - Update license:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $id | License ID. | string | Yes | | $appID | Application table id. | int | Yes | | $siteID | Site table id. | int | Yes | | $key | License key. | string | Yes | | $state | License state. | bool | Yes | | $expire | License expiration date. | string| Yes | @return (int) ? Rows affected. - Check if license exists:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $license | License key. | string | Yes | @return (boolean) Options- Add option:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $licenseID | License table id. | string | Yes | | $name | Option name. | string | Yes | | $value | Option value. | string | Yes | @return (int) ? Option inserted ID. - Update option:
| Atttribute | Description | Type | Required | --- | --- | --- | --- | | $id | Option ID. | string | Yes | | $licenseID | License table id. | string | Yes | | $name | Option name. | string | Yes | | $value | Option value. | string | Yes | @return (int) ? Rows affected. Quick StartTo use this plugin, your Eliasis application must use the PHP-Database library and add the following to the application configuration files:
And get the instances from each table:
UsageApplications- Add application:
- Update application:
Sites- Add site:
- Update site:
License- Generate license key:
- Add license:
- Update license:
- Check if license exists:
Options- Add option:
- Update option:
DatabaseThis plugin will create the following tables. - test_applications:The table structure created is as follows: | Columns | Data type | | --- | --- | | app_id | INT(9) | | app_name | VARCHAR(80) | | app_type | VARCHAR(80) | | app_category | VARCHAR(80) | | app_state | INT(1) | | updated | TIMESTAMP | | created | TIMESTAMP | - test_sites:The table structure created is as follows: | Columns | Data type | | --- | --- | | site_id | INT(9) | | site_domain | VARCHAR(255) | | site_host | VARCHAR(255) | | site_ip | VARCHAR(1) | | site_authorized | INT(1) | | updated | TIMESTAMP | | created | TIMESTAMP | - test_licenses:The table structure created is as follows: | Columns | Data type | | --- | --- | | lic_id | INT(9) | | app_id | INT(9) | | site_id | INT(9) | | lic_key | VARCHAR(29) | | lic_state | INT(1) | | lic_expire | DATETIME | | site_authorized | INT(1) | | updated | TIMESTAMP | | created | TIMESTAMP | - test_options:The table structure created is as follows: | Columns | Data type | | --- | --- | | option_id | INT(9) | | lic_id | INT(9) | | option_name | VARCHAR(180) | | option_value | LONGTEXT | TestsTo run tests you just need composer and to execute the following:
Run unit tests with PHPUnit:
Run PSR2 code standard tests with PHPCS:
Run PHP Mess Detector tests to detect inconsistencies in code style:
Run all previous tests:
? TODO
ContributeIf you would like to help, please take a look at the list of issues or the To Do checklist. Pull requests
LicenseThis project is licensed under MIT license. See the LICENSE file for more info. Copyright2017 - 2018 Josantonius, josantonius.com If you find it useful, let me know :wink: |