ibilalkhilji / secure-laravel
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/ibilalkhilji/secure-laravel
Requires
- ext-curl: *
README
A lightweight Laravel security enhancement package by Bilal Khilji β designed to add advanced licensing, authorization, and integrity protection layers to your Laravel applications.
π Features
- π§© Plug-and-play Laravel Service Provider
- πͺͺ License validation and encryption
- π₯οΈ Machine fingerprinting support
- π IP, domain, and usage tracking
- π§± Pre-boot protection for unauthorized copies
- βοΈ Helper functions for secure key management
- πͺΆ Zero configuration β autoloaded via Composer
- π§© Dynamic patch injection for
Application.phpandindex.php
π¦ Installation
Require the package via Composer:
composer require ibilalkhilji/secure-laravel
Then run the migrations (this step is required):
php artisan migrate
This will create the necessary database tables for license management and usage tracking.
βοΈ Configuration
No manual configuration or file export is required. The package auto-registers its service provider and uses sensible defaults for most environments.
You can, however, override behavior directly through environment variables or by extending the default classes under src/.
Example:
SECURE_LARAVEL_ENDPOINT=https://your-license-server.com
π§© Dynamic Patch Injection
SecureLaravel allows you to dynamically patch your Laravel core files β like Application.php and index.php β without modifying them manually.
Simply place your patch files inside the Patches folder located at the Laravel base path:
/basepath/Patches/
βββ Application.php
βββ index.php
At runtime, the package automatically detects and injects these patch files, ensuring seamless updates and rollback safety.
This is particularly useful for:
- Injecting licensing validation before Laravel boot
- Enforcing pre-startup checks for unauthorized copies
- Extending bootstrap logic securely
Fallback behavior: If no dynamic patch files are provided in the Patches folder, SecureLaravel will fall back to its built-in default implementations (no changes to your core files).
π§ Usage
1οΈβ£ Register License
You can register or verify your license key using the helper:
use Ibilalkhilji\\SecureLaravel\\Facades\\SecureLaravel; SecureLaravel::validateLicense('YOUR-LICENSE-KEY');
2οΈβ£ Retrieve Machine Fingerprint
Get a unique hash based on system and environment data:
$fingerprint = SecureLaravel::fingerprint();
3οΈβ£ Track Usage
Record usage meta for your application:
SecureLaravel::track([ 'ip' => request()->ip(), 'user_agent' => request()->userAgent(), ]);
π§° Helper Functions
| Function | Description |
|---|---|
secure_check() |
Validates if the app is licensed |
secure_fingerprint() |
Returns system fingerprint |
secure_encrypt($data) |
Encrypts data with package key |
secure_decrypt($data) |
Decrypts data securely |
π§© Folder Structure
src/
βββ Facades/
βββ Http/
βββ Services/
βββ Traits/
βββ Helpers/helpers.php
βββ SecurityServiceProvider.php
π Example Middleware
You can use the provided middleware to protect routes:
Route::middleware(['secure.license'])->group(function () { Route::get('/dashboard', [DashboardController::class, 'index']); });
βπ» Author
Bilal Khilji π§ kbinfo4u@gmail.com π GitHub: ibilalkhilji
π License
This package is open-sourced software licensed under the MIT license.
π‘ Notes
If youβre building a SaaS or distributed Laravel product, this package is ideal for embedding robust licensing and usage validation directly into your codebase.
π§± Version
v1.0.11
