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

1.0.12 2025-11-08 09:19 UTC

This package is auto-updated.

Last update: 2025-11-08 09:19:37 UTC


README

Secure Laravel GitHub Issues or Pull Requests GitHub Tag GitHub contributors GitHub Repo stars

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.php and index.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