License manager package for Laravel applications
imtaxu/laravel-license is a Laravel package for license manager package for laravel applications.
It currently has 0 GitHub stars and 10 downloads on Packagist (latest version v1.0.1).
Install it with composer require imtaxu/laravel-license.
Discover more Laravel packages by imtaxu
or browse all Laravel packages to compare alternatives.
Last updated
A license manager package for Laravel applications that provides robust license verification, activation, and obfuscation capabilities.
You can install the package via composer:
composer require imtaxu/laravel-license
After installation, run the following command to publish the configuration file:
php artisan vendor:publish --tag=license-config
If you want to customize the view file, run the following command:
php artisan vendor:publish --tag=license-views
To publish language files:
php artisan vendor:publish --tag=license-translations
Add the following variables to your .env file:
APP_LICENSE=your-license-key
APP_VERSION=your-app-version
You can customize the variables to be sent for license checking and other settings by opening the config/license.php file.
After editing your license configuration file, run the following command to encrypt and protect the file:
php artisan license:obfuscate
This command obfuscates your configuration and route files, making them difficult to modify or tamper with. If the file content is altered or deleted after encryption, the system will automatically redirect to the license error page.
To protect routes with license checking, add the middleware to your routes:
// In a route file
Route::middleware('license')->group(function () {
// Your protected routes
});
// Or in a controller
public function __construct()
{
$this->middleware('license');
}
You can use the License facade to check license status manually:
use Imtaxu\LaravelLicense\Facades\License;
if (License::isValid()) {
// License is valid
} else {
// License is invalid
}
Activate a license key through the command line:
php artisan license:activate YOUR-LICENSE-KEY
Or use the provided activation form at /license/activate.
You can configure exemptions for specific routes or IP addresses in the config file:
'exemptions' => [
'routes' => [
'login',
'register',
'password/*',
],
'ips' => [
'127.0.0.1',
'::1',
],
],
php artisan license:activate - Activate a license keyphp artisan license:deactivate - Deactivate the current licensephp artisan license:verify - Verify license statusphp artisan license:obfuscate - Obfuscate protected filesThe package includes a license management dashboard. To set it up:
config/license.phphttps://your-domain.com/license-adminTo create your own license server:
A license server implementation is available in the Laravel License Admin Panel repository. You can use this as a starting point for creating your own license server.
The features field in the license system is a completely optional feature that allows you to dynamically manage license features by storing data in JSON format. This field facilitates feature-based license management for your applications.
{
"premium_access": true,
"max_users": 50,
"modules": ["reporting", "analytics", "export"],
"storage_limit": "10GB",
"api_rate_limit": 1000,
"custom_settings": {
"theme": "dark",
"notification_channels": ["email", "sms"],
"data_retention_days": 90
}
}
| Feature | Description | Usage Example |
|----------|------------|---------------|
| premium_access | Permission to access premium features | if ($license->hasFeature('premium_access')) { // Show premium features } |
| max_users | Maximum number of users that can be added to the system | if (count($users) < $license->hasFeature('max_users', 10)) { // Add new user } |
| modules | List of modules with access permission | if ($license->hasModuleAccess('reporting')) { // Show reporting module } |
| storage_limit | Storage space limit | if ($fileSize + $currentUsage < parseSize($license->hasFeature('storage_limit', '1GB'))) { // Upload file } |
| api_rate_limit | API request limit | if ($requestCount < $license->hasFeature('api_rate_limit', 100)) { // Process API request } |
// Get all features
$features = License::getLicenseFeatures();
// Check a specific feature
$maxUsers = License::hasFeature('max_users', 10); // Default value: 10
// Check module access
if (License::hasModuleAccess('reporting')) {
// Has access to reporting module
} else {
// No access to reporting module
}
The package supports various permission systems to control admin access:
// config/license.php
'admin_check' => 'role', // Options: 'role', 'permission', 'is_admin', 'custom'
'admin_role' => 'admin',
'admin_permission' => 'manage_licenses',
You can extend AdminLicenseMiddleware for custom authorization logic.
This package includes several security features:
Contributions are welcome! Please feel free to submit a Pull Request.
This package is open-sourced software licensed under the MIT license.
Laravel uygulamaları için güçlü lisans doğrulama, aktivasyon ve kod karıştırma özellikleri sunan bir lisans yönetim paketidir.
Composer aracılığıyla paketi projenize ekleyin:
composer require imtaxu/laravel-license
Kurulumdan sonra, yapılandırma dosyasını yayınlamak için aşağıdaki komutu çalıştırın:
php artisan vendor:publish --tag=license-config
Görünüm dosyasını özelleştirmek isterseniz, aşağıdaki komutu çalıştırın:
php artisan vendor:publish --tag=license-views
Dil dosyalarını yayınlamak için:
php artisan vendor:publish --tag=license-translations
.env dosyanıza aşağıdaki değişkenleri ekleyin:
APP_LICENSE=your-license-key
APP_VERSION=your-app-version
config/license.php dosyasını açarak lisans kontrolü için gönderilecek değişkenleri ve diğer ayarları özelleştirebilirsiniz.
Lisans yapılandırma dosyanızı düzenledikten sonra, dosyayı şifrelemek ve korumak için aşağıdaki komutu çalıştırın:
php artisan license:obfuscate
Bu komut, yapılandırma ve rota dosyalarınızı karıştırarak değiştirilmesini veya kurcalanmasını zorlaştırır. Şifreleme işlemi sonrasında, dosya içeriği değiştirilirse veya silinirse, sistem otomatik olarak lisans hata sayfasına yönlendirecektir.
Rotaları lisans kontrolü ile korumak için, middleware'i rotalarınıza ekleyin:
// Bir rota dosyasında
Route::middleware('license')->group(function () {
// Korunan rotalarınız
});
// Veya bir controller'da
public function __construct()
{
$this->middleware('license');
}
Lisans durumunu manuel olarak kontrol etmek için License facade'ini kullanabilirsiniz:
use Imtaxu\LaravelLicense\Facades\License;
if (License::isValid()) {
// Lisans geçerli
} else {
// Lisans geçersiz
}
Komut satırından bir lisans anahtarını aktifleştirin:
php artisan license:activate LİSANS-ANAHTARINIZ
Veya /license/activate adresindeki aktivasyon formunu kullanın.
Belirli rotalar veya IP adresleri için muafiyetleri yapılandırma dosyasında ayarlayabilirsiniz:
'exemptions' => [
'routes' => [
'login',
'register',
'password/*',
],
'ips' => [
'127.0.0.1',
'::1',
],
],
php artisan license:activate - Lisans anahtarını aktifleştirirphp artisan license:deactivate - Mevcut lisansı devre dışı bırakırphp artisan license:verify - Lisans durumunu doğrularphp artisan license:obfuscate - Korumalı dosyaları karıştırırPaket, lisans yönetim paneli içerir. Kurulum için:
config/license.php üzerinden panele erişimi yapılandırınhttps://your-domain.com/license-admin adresinden erişinKendi lisans sunucunuzu oluşturmak için:
Laravel License Admin Panel deposunda bir lisans sunucusu uygulaması bulunmaktadır. Kendi lisans sunucunuzu oluşturmak için bunu başlangıç noktası olarak kullanabilirsiniz.
Lisans sisteminde features alanı, tamamen opsiyonel bir özelliktir ve JSON formatında veri saklayarak lisansların özelliklerini dinamik olarak yönetmenize olanak tanır. Bu alan, uygulamalarınızın lisans bazlı özellik yönetimini kolaylaştırır.
{
"premium_access": true,
"max_users": 50,
"modules": ["reporting", "analytics", "export"],
"storage_limit": "10GB",
"api_rate_limit": 1000,
"custom_settings": {
"theme": "dark",
"notification_channels": ["email", "sms"],
"data_retention_days": 90
}
}
| Özellik | Açıklama | Kullanım Örneği |
|----------|------------|---------------|
| premium_access | Premium özelliklere erişim izni | if ($license->hasFeature('premium_access')) { // Premium özellikleri göster } |
| max_users | Sisteme eklenebilecek maksimum kullanıcı sayısı | if (count($users) < $license->hasFeature('max_users', 10)) { // Yeni kullanıcı ekle } |
| modules | Erişim izni olan modüllerin listesi | if ($license->hasModuleAccess('reporting')) { // Raporlama modülünü göster } |
| storage_limit | Depolama alanı limiti | if ($fileSize + $currentUsage < parseSize($license->hasFeature('storage_limit', '1GB'))) { // Dosyayı yükle } |
| api_rate_limit | API istek limiti | if ($requestCount < $license->hasFeature('api_rate_limit', 100)) { // API isteğini işle } |
// Tüm özellikleri al
$features = License::getLicenseFeatures();
// Belirli bir özelliği kontrol et
$maxUsers = License::hasFeature('max_users', 10); // Varsayılan değer: 10
// Modül erişimini kontrol et
if (License::hasModuleAccess('reporting')) {
// Raporlama modülüne erişim var
} else {
// Raporlama modülüne erişim yok
}
Paket, admin erişimini kontrol etmek için çeşitli izin sistemlerini destekler:
// config/license.php
'admin_check' => 'role', // Seçenekler: 'role', 'permission', 'is_admin', 'custom'
'admin_role' => 'admin',
'admin_permission' => 'manage_licenses',
Özel yetkilendirme mantığı için AdminLicenseMiddleware sınıfını genişletebilirsiniz.
Bu paket şu güvenlik özelliklerini içerir:
Katkılarınızı bekliyoruz! Lütfen bir Pull Request göndermekten çekinmeyin.
Bu paket, MIT lisansı altında lisanslanmış açık kaynaklı bir yazılımdır.