Laravel and Lumen Source Code Encrypter
No Data
This package encrypts your php code with phpBolt
For Laravel and Lumen 5.5+, 6, 7, 8
At the first, You have to install phpBolt.
Require the package with composer using the following command:
bash composer require --dev sbamtr/laravel-source-encrypter
The service provider will automatically get registered. Or you may manually add the service provider in your
config/app.phpfile:
php 'providers' => [ // ... \sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider::class, ];
Add this line of code under the
Register Service Providerssection of your
bootstrap/app.php:
php $app->register(\sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider::class);
You can publish the config file with this following command:
bash php artisan vendor:publish --provider="sbamtr\LaravelSourceEncrypter\SourceEncryptServiceProvider" --tag=configNote: If you are using Lumen, you have to use this package.
Open terminal in project root and run this command:
bash php artisan encrypt-sourceThis command encrypts files and directories in
config/source-encrypter.phpfile. Default values are
app,
database,
routes.
The default destination directory is
encrypted. You can change it in
config/source-encrypter.phpfile.
Also the default encryption key length is
6. You can change it in
config/source-encrypter.phpfile.
6is 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 | |
| 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
appdirectory to the default destination with default keylength. | |
php artisan encrypt-source --destination=dist| Encrypts with default source and key length to
distdirectory. | |
php artisan encrypt-source --destination=dist --keylength=8| Encrypts default source to
distdirectory and the encryption key length is
8. |
Written with ♥ by Siavash Bamshadnia.
Please support me by staring this repository.