Download the PHP package mhassan654/licensing-server without Composer
On this page you can find all versions of the php package mhassan654/licensing-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mhassan654/licensing-server
More information about mhassan654/licensing-server
Files in mhassan654/licensing-server
Package licensing-server
Short Description Licensing server for Laravel
License MIT
Informations about the package licensing-server
Licensing Server
📂 About
License Server package, which is a Laravel package that allows you to manage your Laravel applications license. You can use it with any product or service. License Server comes with the agnostic license management system, which allows you to manage your licenses in a simple and easy way. Just add license relation to any product model then you can work in your logic.
This package requires license-connector package. Licensing Connector is client implementation for License Server. Package for the client makes a request to License Server and gets a response.
📋 Requirements
PHP
Laravel
- Laravel 8.x or 9.x version
📦 Installation (for Host App)
Get via composer
Publish migrations and migrate
Configs are very important. You can find them in license-server.php file. You should read all configs and configure for your needs.
🗝️ Model Relations
Every license must-have product, because we need to know what it is licensed for. The client application will send this information to the License Server. Then we can check if the license is valid for given the product.
Product model can be any model that you want to be licensed. Add Licensable trait to your product model.
📌 Service Methods
Add in your namespace list:
use Mhassan654\LicenseServer\Services\LicenseService;
and product model
use App\Models\Product;
addLicense
First, we need to know licensing models. This package supports two types of licensing models: to Domain and to User. Both of them are valid. If you want to add license to domain, you must pass domain
parameter. If you want to add license to user, you must pass userId
parameter. Also, when you pass both of them, you will get domain license.
- If you provide domain, then the license will be added to the domain. If you don't provide domain, then the license will be added to the user (in this case user id is required.).
- Other parameters are optional and do not forget to configure configs.
- This method returns
Mhassan654\LicenseServer\Models\License
model. - All license keys are in UUID format.
getLicenseBy*
- getLicenseByKey: get license by license key.
LicenseService::getLicenseByKey(string $licenseKey)
- getLicenseByUserId: get license by user id and license key.
LicenseService::getLicenseByUserId(int $userId, string $licenseKey = null)
- getLicenseByDomain: get license by domain and license key.
LicenseService::getLicenseByDomain(string $domain, string $licenseKey = null)
checkLicenseStatus
Returns "active", "inactive", "suspended", "expired", "invalid-license-key" and "no-license-found".
setLicenseStatus
You can only set active
, inactive
, suspended
status.
🛠️ Custom Controller
If you want to use own license validation controller you can integrate it easily.
Click to see the example!
Then you need to register this custom controller in your config/license-server.php
file.
Click to see the example!
🪢 Events
🪡 LicenseChecked Event
You can send custom data with connector and on the license server-side, you can catch this custom data. First you need to create a listener for this event.
Add class LicenseChecked
with Mhassan654\LicenseServer\Events\LicenseChecked
namespace. You can retrieve custom data from event.
Finally, you need to register this listener in your config/license-server.php
file.
Click to see the example!
Ready to Use API
Ready to use API is included with simple resource methods. API endpoint is /api/license-server/licenses
.
Domain Validation
License Server uses a cache to store the public tld list. See tld list at https://data.iana.org/TLD/tlds-alpha-by-domain.txt
The TLD list cache is will be stored at the storage/license-server/iana-tld-list.txt
file and do not edit this file.
In development you may use domain like example.test
etc. but you won't pass domain validation because the test
is not valid tld.
⚠️ Warnings
- This package is under active development and is not yet stable. There may be some changes in later versions.
- Don't forget this package just provides management of licenses and product/customer communication.
- Please don't confuse it with ioncube or similar source code encryption tools.
All versions of licensing-server with dependencies
ext-filter Version *
ext-intl Version *
ext-json Version *
illuminate/support Version ^8.0
jeremykendall/php-domain-parser Version ^6.1
mhassan654/license-support Version ^1.0
laravel/sanctum Version ^2.1 || ^3.0