slavytuch / laravel-source-encrypter
Encrypt Laravel application source files with phpBolt
Package info
github.com/slavytuch/Laravel-Source-Encrypter
pkg:composer/slavytuch/laravel-source-encrypter
Requires
- php: >=7.2.5
- ext-bolt: *
- illuminate/console: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0
- illuminate/support: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0
Replaces
- sbamtr/laravel-source-encrypter: v1.7.0
This package is auto-updated.
Last update: 2026-07-23 13:51:23 UTC
README
This package encrypts your PHP source code with phpBolt.
Supports Illuminate Console 6 through 13, including Laravel 13.
Installation
Step 1
Install the phpBolt extension for the PHP runtime that will execute the command.
Step 2
Require the package with composer using the following command:
composer require --dev slavytuch/laravel-source-encrypter
Step 3
For Laravel
The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:
'providers' => [ // ... \sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider::class, ];
For Lumen
Add this line of code under the Register Service Providers section of your bootstrap/app.php:
$app->register(\sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider::class);
Step 4 (Optional)
You can publish the config file with this following command:
php artisan vendor:publish --provider="sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider" --tag=config
Note: If you are using Lumen, you have to use this package.
Usage
Open terminal in project root and run this command:
php artisan encrypt-source
This command encrypts files and directories in config/source-encrypter.php file. Default values are app, database, routes.
The default destination directory is encrypted. You can change it in config/source-encrypter.php file.
Also the default encryption key length is 6. You can change it in config/source-encrypter.php file. 6 is the recommended key length.
This command has these optional options:
| Option | Description | Example |
|---|---|---|
| source | Path(s) to encrypt | app,routes,public/a.php |
| destination | Destination directory | encrypted |
| keylength | Encryption key length | 6 |
| force | Force the operation to run when destination directory already exists |
Usage Examples
| Command | Description |
|---|---|
php artisan encrypt-source |
Encrypts with default source, destination and keylength. If the destination directory exists, asks for delete it. |
php artisan encrypt-source --force |
Encrypts with default source, destination and keylength. If the destination directory exists, deletes it. |
php artisan encrypt-source --source=app |
Encrypts app directory to the default destination with default keylength. |
php artisan encrypt-source --destination=dist |
Encrypts with default source and key length to dist directory. |
php artisan encrypt-source --destination=dist --keylength=8 |
Encrypts default source to dist directory and the encryption key length is 8. |
Originally created by Siavash Bamshadnia and distributed under the MIT license. This fork preserves the original runtime behavior and adds Laravel 13 package compatibility.
