PHPackages                             ziishaned/php-license - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ziishaned/php-license

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ziishaned/php-license
=====================

PHP library for generating and parsing license

v0.0.1(7y ago)825968[1 issues](https://github.com/ziishaned/php-license/issues)MITPHPPHP &gt;=5.4

Since Feb 9Pushed 7y ago4 watchersCompare

[ Source](https://github.com/ziishaned/php-license)[ Packagist](https://packagist.org/packages/ziishaned/php-license)[ RSS](/packages/ziishaned-php-license/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

 [![php-license is a library for generating and parsing license](https://camo.githubusercontent.com/31557e0f19f45b429d16d0dd93ae88d7befd782fe5fde6ec484be78240fd8544/68747470733a2f2f696d6167652e666c617469636f6e2e636f6d2f69636f6e732f7376672f32312f32313232362e737667)](https://camo.githubusercontent.com/31557e0f19f45b429d16d0dd93ae88d7befd782fe5fde6ec484be78240fd8544/68747470733a2f2f696d6167652e666c617469636f6e2e636f6d2f69636f6e732f7376672f32312f32313232362e737667)
 PHP License
================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-php-license)

 [ ![Codecov](https://camo.githubusercontent.com/71b8ce0c46f9b8d2c3e5bb3425c1a071b8070e3fa32dc6eea339a0d64cc08836/68747470733a2f2f636f6465636f762e696f2f67682f7a69697368616e65642f7068702d6c6963656e73652f6272616e63682f6d61737465722f67726170682f62616467652e737667) ](https://codecov.io/gh/ziishaned/php-license) [ ![Build Status](https://camo.githubusercontent.com/0575f1947adc9c2b849e4e34d7ada833bc7307878a48306070aed1cf62c281e5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7a69697368616e65642f7068702d6c6963656e73652e7376673f7374796c653d666c6174) ](https://travis-ci.org/ziishaned/php-license) [ ![](https://camo.githubusercontent.com/e1887d37276710dea176e81f603aaee177fc80cb7466c7ed3af3951e6e8e3a2c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d74776565742d626c75652e7376673f7374796c653d666c61742d737175617265) ](https://twitter.com/home?status=PHP%20License%20by%20%40ziishaned%20http%3A//github.com/ziishaned/php-license) [ ![](https://camo.githubusercontent.com/bba2cc003f1b323c8fdcb7ec21f7ad7f0208abfad9845503d3fc220d6834e5a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666565646261636b2d407a69697368616e65642d626c75652e7376673f7374796c653d666c61742d737175617265) ](https://twitter.com/ziishaned)

`php-license` is a library for generating and parsing license.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.4
- OpenSSL

Generating Key Pair
-------------------

[](#generating-key-pair)

Make sure OpenSSL is configured on your machine.

1. Generate the Private key file by running the following command:

    ```
    openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
    ```
2. Run the following command to generate public key:

    ```
    openssl rsa -pubout -in private_key.pem -out public_key.pem
    ```

Installation
------------

[](#installation)

```
composer require ziishaned/php-license
```

Usage
-----

[](#usage)

Before running the following code make sure you have the `public_key` and `private_key` files.

### Generating

[](#generating)

Use the following code to generate the license key:

```
