PHPackages                             ibilalkhilji/secure-laravel - 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. [Security](/categories/security)
4. /
5. ibilalkhilji/secure-laravel

ActiveLibrary[Security](/categories/security)

ibilalkhilji/secure-laravel
===========================

1.0.12(6mo ago)08MITPHP

Since Nov 6Pushed 6mo agoCompare

[ Source](https://github.com/ibilalkhilji/secure-laravel)[ Packagist](https://packagist.org/packages/ibilalkhilji/secure-laravel)[ RSS](/packages/ibilalkhilji-secure-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

🔒 SecureLaravel
===============

[](#-securelaravel)

[![Secure Laravel](banner.png)](banner.png)[![GitHub Issues or Pull Requests](https://camo.githubusercontent.com/25962d34ee9e12d96a32934a0d06895e910d3027c005950b7d61d8475c6bdb57/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)](https://camo.githubusercontent.com/25962d34ee9e12d96a32934a0d06895e910d3027c005950b7d61d8475c6bdb57/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)[![GitHub Tag](https://camo.githubusercontent.com/26a30307767b09dd8f2ccd45cb7baf781fcd3d02e2369e3821db1b3783cfbcd3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6962696c616c6b68696c6a692f7365637572652d6c61726176656c3f6c6162656c3d76657273696f6e)](https://camo.githubusercontent.com/26a30307767b09dd8f2ccd45cb7baf781fcd3d02e2369e3821db1b3783cfbcd3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6962696c616c6b68696c6a692f7365637572652d6c61726176656c3f6c6162656c3d76657273696f6e)[![GitHub contributors](https://camo.githubusercontent.com/cbfaeea4c80667caa01fdedb5ef7ac52f3c2a4ebba858df4735c72445e58dea2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)](https://camo.githubusercontent.com/cbfaeea4c80667caa01fdedb5ef7ac52f3c2a4ebba858df4735c72445e58dea2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)[![GitHub Repo stars](https://camo.githubusercontent.com/235f6c4ce8e6ccb5448f173498edcc58abb50d4715f927cbfc80d405f0df30c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)](https://camo.githubusercontent.com/235f6c4ce8e6ccb5448f173498edcc58abb50d4715f927cbfc80d405f0df30c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6962696c616c6b68696c6a692f7365637572652d6c61726176656c)

A lightweight Laravel security enhancement package by **Bilal Khilji** — designed to add advanced licensing, authorization, and integrity protection layers to your Laravel applications.

---

🚀 Features
----------

[](#-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
--------------

[](#-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
----------------

[](#️-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
-------------------------

[](#-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
-------

[](#-usage)

### 1️⃣ Register License

[](#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

[](#2️⃣-retrieve-machine-fingerprint)

Get a unique hash based on system and environment data:

```
$fingerprint = SecureLaravel::fingerprint();
```

### 3️⃣ Track Usage

[](#3️⃣-track-usage)

Record usage meta for your application:

```
SecureLaravel::track([
    'ip' => request()->ip(),
    'user_agent' => request()->userAgent(),
]);
```

---

🧰 Helper Functions
------------------

[](#-helper-functions)

FunctionDescription`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
------------------

[](#-folder-structure)

```
src/
 ├── Facades/
 ├── Http/
 ├── Services/
 ├── Traits/
 ├── Helpers/helpers.php
 └── SecurityServiceProvider.php

```

---

🔐 Example Middleware
--------------------

[](#-example-middleware)

You can use the provided middleware to protect routes:

```
Route::middleware(['secure.license'])->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index']);
});
```

---

‍💻 Author
---------

[](#‍-author)

**Bilal Khilji**📧 🌍 [GitHub: ibilalkhilji](https://github.com/ibilalkhilji)

---

📜 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

💡 Notes
-------

[](#-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

[](#-version)

**v1.0.11**

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance68

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

9

Last Release

186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3294fb4f0b9cf3412c757ef470160f819a62a55a13a6e33409f5f5ee19227f94?d=identicon)[kbinfo4u](/maintainers/kbinfo4u)

---

Top Contributors

[![ibilalkhilji](https://avatars.githubusercontent.com/u/14019618?v=4)](https://github.com/ibilalkhilji "ibilalkhilji (17 commits)")

### Embed Badge

![Health badge](/badges/ibilalkhilji-secure-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/ibilalkhilji-secure-laravel/health.svg)](https://phpackages.com/packages/ibilalkhilji-secure-laravel)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
