PHPackages                             dev-reymark/laravel-source-encryptor - 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. dev-reymark/laravel-source-encryptor

ActiveLibrary[Security](/categories/security)

dev-reymark/laravel-source-encryptor
====================================

Encrypt Laravel source code for secure Laravel distribution

v1.0.4(1mo ago)17↓50%1MITPHPPHP ^8.2

Since Mar 4Pushed 1mo agoCompare

[ Source](https://github.com/dev-reymark/laravel-source-encryptor)[ Packagist](https://packagist.org/packages/dev-reymark/laravel-source-encryptor)[ Docs](https://github.com/dev-reymark/laravel-source-encryptor)[ RSS](/packages/dev-reymark-laravel-source-encryptor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

Laravel Source Encryptor
========================

[](#laravel-source-encryptor)

[![Latest Version](https://camo.githubusercontent.com/7e535a469efee5e3d982b388f3620cc3a345cb642cb19af539d6b1cec096671b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465762d7265796d61726b2f6c61726176656c2d736f757263652d656e63727970746f722e737667)](https://packagist.org/packages/dev-reymark/laravel-source-encryptor)[![Total Downloads](https://camo.githubusercontent.com/31b590eca0ea053615215c19a0fd0bfc8b4de3581a62466dbf15cd49526d3835/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465762d7265796d61726b2f6c61726176656c2d736f757263652d656e63727970746f722e737667)](https://packagist.org/packages/dev-reymark/laravel-source-encryptor)[![License](https://camo.githubusercontent.com/b7fe0bc184fc43a591bf191157172939451a7251fb554641804b2131ddc49f9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465762d7265796d61726b2f6c61726176656c2d736f757263652d656e63727970746f722e737667)](https://packagist.org/packages/dev-reymark/laravel-source-encryptor)[![Laravel](https://camo.githubusercontent.com/cda3a3caf1337c6e594a2b1be6a3166edf268a87d7254f5c4c82f1483814c1d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125323025374325323031322d7265642e737667)](https://laravel.com)

Encrypt Laravel source code and safely distribute applications **without exposing PHP source files**. Converts your Laravel application's PHP files into encrypted code that is decrypted only at runtime, allowing you to distribute Laravel applications while protecting your intellectual property.

Features
--------

[](#features)

- Encrypt controllers, models, services, and routes
- Bundle encrypted code into a single runtime file
- Runtime decryption via custom autoloader
- Automatic Composer and npm build handling
- Cross-platform (Windows, Linux, macOS)
- Laravel 11 &amp; 12 support
- Optimized distribution builds
- No external PHP extensions required

Quick Installation
------------------

[](#quick-installation)

```
composer require dev-reymark/laravel-source-encryptor
php artisan vendor:publish --tag=source-encryptor-config
```

Configuration
-------------

[](#configuration)

Add to `.env`:

```
SOURCE_ENCRYPTION_KEY=your_hex_key_here

```

Generate a secure key:

```
php -r "echo bin2hex(random_bytes(32));"
```

Usage
-----

[](#usage)

### Build Production Distribution

[](#build-production-distribution)

```
php artisan source:build
```

The command will:

1. Installs Composer dependencies (--no-dev)
2. Installs npm dependencies if needed
3. Builds frontend assets (Vite / React / Vue)
4. Encrypts Laravel source files
5. Bundles encrypted code into a runtime file
6. Removes the original app/ directory
7. Generates encrypted route loaders
8. Create a clean **distribution folder** at `dist/`

Distribution Structure
----------------------

[](#distribution-structure)

```
dist/
 ├ artisan
 ├ bootstrap/
 │   └ cache/
 │       └ source.enc
 ├ routes/
 ├ config/
 ├ public/
 ├ storage/
 └ vendor/

```

The original `app/` directory is removed. All encrypted source code is stored inside `bootstrap/cache/source.enc`.

Build Options
-------------

[](#build-options)

Skip frontend build: Useful for API-only applications

```
php artisan source:build --no-frontend
```

Skip composer install: Useful in CI/CD pipelines or Docker builds.

```
php artisan source:build --skip-composer
```

Running the Encrypted Application
---------------------------------

[](#running-the-encrypted-application)

```
cd dist
php artisan serve
```

Laravel automatically loads encrypted classes through the runtime loader.

How It Works
------------

[](#how-it-works)

1. PHP files are compressed and encrypted using **AES-256-CBC**
2. Encrypted code is bundled into `bootstrap/cache/source.enc`
3. During runtime: Autoload request → EncryptedAutoloader → SourceLoader decrypts → PHP executes
4. Decrypted source **never persists on disk**

Frontend Support
----------------

[](#frontend-support)

The build system automatically detects frontend environments:

EnvironmentBehaviorAPI-only LaravelSkips frontend buildLaravel + BladeSkips if no build scriptVue Starter KitRuns `npm install` + `npm run build`React Starter KitRuns `npm install` + `npm run build`Vite ProjectsFully supportedRequirements
------------

[](#requirements)

- PHP **8.2+**
- Laravel **11 or 12**
- OpenSSL extension enabled
- Composer

Security Notes
--------------

[](#security-notes)

- Keep your `SOURCE_ENCRYPTION_KEY` private
- Never commit `.env` to version control
- Only distribute the `dist/` directory

License
-------

[](#license)

MIT License

Author
------

[](#author)

**Rey Mark Tapar**

[Website](https://reymarktapar.vercel.app) | [GitHub](https://github.com/dev-reymark/laravel-source-encryptor)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~5 days

Total

5

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1119af13fed3d3cddc5b7fbdce76cf019b760f076ab94e1503502b4333aceec?d=identicon)[dev-reymark](/maintainers/dev-reymark)

---

Top Contributors

[![dev-reymark](https://avatars.githubusercontent.com/u/139051128?v=4)](https://github.com/dev-reymark "dev-reymark (6 commits)")

---

Tags

laravelencryptionlaravel-packagecode-protectionsource-protection

### Embed Badge

![Health badge](/badges/dev-reymark-laravel-source-encryptor/health.svg)

```
[![Health](https://phpackages.com/badges/dev-reymark-laravel-source-encryptor/health.svg)](https://phpackages.com/packages/dev-reymark-laravel-source-encryptor)
```

###  Alternatives

[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)

PHPackages © 2026

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