PHPackages                             rezgui/laravel-source-encrypter - 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. rezgui/laravel-source-encrypter

ActiveLibrary[Security](/categories/security)

rezgui/laravel-source-encrypter
===============================

Laravel Source Encrypter 6 / 7 / 8 / 9 / 10 / 11

v1.0.4(1y ago)395—0%1[1 issues](https://github.com/rezgui/Laravel-Source-Encrypter/issues)MITPHPPHP &gt;=7.2.5

Since Nov 7Pushed 1y agoCompare

[ Source](https://github.com/rezgui/Laravel-Source-Encrypter)[ Packagist](https://packagist.org/packages/rezgui/laravel-source-encrypter)[ GitHub Sponsors](https://github.com/feross)[ GitHub Sponsors](https://github.com/standard)[ RSS](/packages/rezgui-laravel-source-encrypter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Laravel Source Encrypter
========================

[](#laravel-source-encrypter)

[![License](https://camo.githubusercontent.com/b075157383cb80fd92c3c9e174ba8763b1266da5755c051ad62160c2b4881c05/68747470733a2f2f706f7365722e707567782e6f72672f72657a6775692f6c61726176656c2d736f757263652d656e637279707465722f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://github.com/rezgui/Laravel-Source-Encrypter)[![Latest Stable Version](https://camo.githubusercontent.com/0b2d61169265572b4b45eb1c041f5dd04d6600786cb07f5e9f168bfe9163a07d/68747470733a2f2f706f7365722e707567782e6f72672f72657a6775692f6c61726176656c2d736f757263652d656e637279707465722f762f737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/rezgui/laravel-source-encrypter)[![CodeFactor](https://camo.githubusercontent.com/078f232574e433c1bfbf44f53046254486063e5ceb0d9d1adab3a2c455c3c545/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f72657a6775692f6c61726176656c2d736f757263652d656e637279707465722f62616467653f7374796c653d666f722d7468652d6261646765)](https://www.codefactor.io/repository/github/rezgui/laravel-source-encrypter)[![PHP Version Require](https://camo.githubusercontent.com/d603b5f6b7dbe0588cb3146fb38efe8a94f2b9890c3fdd8b2681a6f5fec8abbf/68747470733a2f2f706f7365722e707567782e6f72672f72657a6775692f6c61726176656c2d736f757263652d656e637279707465722f726571756972652f7068703f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/rezgui/laravel-source-encrypter)[![Total Downloads](https://camo.githubusercontent.com/df4bedb60aca3cb8eb312831ca62ac5e08c6a5064125e19824f73ab1fe087cdc/68747470733a2f2f706f7365722e707567782e6f72672f72657a6775692f6c61726176656c2d736f757263652d656e637279707465722f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/rezgui/laravel-source-encrypter)

[![](cover.jpg)](cover.jpg)

This package encrypts your php code with [phpBolt](https://phpbolt.com)for Laravel and Lumen 6, 7, 8, 9, 10 , 11

- [Introduction](#introduction)
    - [Benifits of Encoding](#benifits-of-encoding)
- [phpBolt encoder](#phpbolt-encoder)
    - [Guide](#guide)
- [Protect Larave Source Code](#protect-larave-source-code)
- [Installation Package](#installation-package)
- [Usage](#usage)

---

Introduction
------------

[](#introduction)

Many PHP developers need to protect their application source code before they distribute it to their customers and make it difficult for others to modify it without their permission.

- There are couple of techniques to protect PHP source code:

    - Making the code difficult to read – which involves in minification &amp; obfuscation
    - **Encoding the source code.**
- There are list of commercial PHP encoders (Zend, ionCube, SourceGuardian, NuCoder, etc).
- A free encoder called **phpBolt** saves you from buying commercial encoders. phpBolt helps to protect your PHP source code by encrypting and decrypting code using a key.

### Benifits of Encoding

[](#benifits-of-encoding)

- Anyone can reuse your PHP script to any web server or localhost. phpBolt will encrypt your source code with a key.
- Advance Protection -- Generate a specific key for each customer.
- Online Encryption -- Encrypt source code from online also possible.
- Encrypt PHP source code and obfuscate the PHP source code.
- Prevent your PHP product from the nulled world.

phpBolt encoder
---------------

[](#phpbolt-encoder)

- The author doesn't care about issues! The author will help you only if you pay for that. (he cannot provide free support)
- phpBolt loader is an extension used to load PHP files protected and encoded using PHP encoder.

### Guide

[](#guide)

1. **Download phpBolt extension for 64-bit System**

    - In order to use phpBolt, you need to [download loader extension](https://phpbolt.com/download-phpbolt/). Look for `bolt.so` inside the corresponding platform folder. ([extension](./assets/phpBolt-extension-1.0.5.zip))
    - Or, directly using following wget command:

        ```
        cd /tmp
        wget https://phpbolt.com/wp-content/uploads/2024/03/phpBolt-extension-1.0.5.zip
        ```
    - Then unzip the downloaded file using the unzip command and move into the decompressed folder.
    - This is a mandatory step. Because PHP engine needs to identify then functions `bolt_encrypt` and `bolt_decrypt` functions.
2. **Install bolt.so extension for PHP**

    - There will be different phpBolt loader files for various PHP versions, you need to select the right phpBolt loader for your installed PHP version on your server.
    - Next, find the location of the extension directory for PHP version **8.2.25** (for example), it is where the phpBolt loader file will be installed. The specified directory from the output of this command:

        ```
        php -i | grep extension_dir
        # output:
        # extension_dir => /usr/lib/php/20220829 => /usr/lib/php/20220829
        ```
    - Copy `bolt.so` from the respective platform folder into the folder where all PHP extensions are stored. In my case, `/usr/lib/php/20220829` was the folder that stores all PHP extensions.
3. **Configure phpBolt Loader for PHP**

    - Find the `php.ini` file and add `extension='/usr/lib/php/20220829/bolt.so'` in `php.ini` file. Then restart your server. Please choose correct `bolt.so` file. `bolt.so` is diffrent for each version and OS.
    - Open `php.ini` as following: `sudo nano /etc/php.ini`
    - Add `blot.so` extension: `extension='/absolute-path/bolt.so'`
    - **Note:**

        ```
        You will be encrypting using CLI,
        then you have to add extension in: `/etc/php/8.2/cli/php.ini` file,
        and in: `php/8.2/apache2/php.ini` file to decode the source code.
        (**Don't forget to restart server**)
        idem for FPM

        ```
    - Remember to replace absolute-path with the path of the extension. In my case: `extension='/usr/lib/php/20220829/bolt.so'`
    - Now we need to restart the Apache, Nginx, or php-fpm web server for the phpBolt loaders to come into effect.
    - Now you have successfully setup bolt loader extension.

Protect Larave Source Code
--------------------------

[](#protect-larave-source-code)

- It is based on phpBolt extension, it encrypts your php code with phpBolt.
- To install and use it in your Laravel project, follow this guide [Installation](#installation).
- There is no way to encrypt blade files. (*blade files are not real PHP files*)

    - [Blade file is not decrypted](https://github.com/SiavashBamshadnia/Laravel-Source-Encrypter/issues/21)
    - [Cannot convert resources/views folder](https://github.com/SiavashBamshadnia/Laravel-Source-Encrypter/issues/20)
- There is no way to decrypt the source code, the **only one who will have the source code is you**.
- You may face some problems/issues when you use encryption commands:

    - [failed to open stream: No such file or directory](https://github.com/SiavashBamshadnia/Laravel-Source-Encrypter/issues/13) (*just modify the `Laravel-Source-Encrypter/src/SourceEncryptCommand.php` file*)
    - You may run the encryption command and everything went well, but you got an exception about `.gitignore`. You don't have to worry about that. Keep going and ignore that exception.

Installation Package
--------------------

[](#installation-package)

### Step 1

[](#step-1)

Require the package with composer using the following command:

```
composer require --dev rezgui/laravel-source-encrypter
```

### Step 2

[](#step-2)

#### For Laravel

[](#for-laravel)

The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file:

```
'providers' => [
    // ...
    \rezgui\LaravelSourceEncrypter\SourceEncryptServiceProvider::class,
];
```

#### For Lumen

[](#for-lumen)

Add this line of code under the `Register Service Providers` section of your `bootstrap/app.php`:

```
$app->register(\rezgui\LaravelSourceEncrypter\SourceEncryptServiceProvider::class);
```

### Step 3 (Optional)

[](#step-3-optional)

You can publish the config file with this following command:

```
php artisan vendor:publish --provider="rezgui\LaravelSourceEncrypter\SourceEncryptServiceProvider" --tag=config
```

**Note:** If you are using Lumen, you have to use [this package](https://github.com/laravelista/lumen-vendor-publish).

Usage
-----

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

OptionDescriptionExamplesourcePath(s) to encryptapp,routes,public/a.phpdestinationDestination directoryencryptedkeylengthEncryption key length6forceForce the operation to run when destination directory already exists### Usage Examples

[](#usage-examples)

CommandDescription`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`.Written with ♥ by Siavash Bamshadnia, and update with ♥ by Yacine REZGUI.

Please support me by staring this repository.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 64.2% 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

4

Last Release

557d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.2.5

v1.0.3PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/d47ad56dd83f56de6e8c9298763e9ce63cbd24765bc97c1e46d05d3c95e0cc22?d=identicon)[rezgui](/maintainers/rezgui)

---

Top Contributors

[![SiavashBamshadnia](https://avatars.githubusercontent.com/u/3998368?v=4)](https://github.com/SiavashBamshadnia "SiavashBamshadnia (34 commits)")[![rezgui](https://avatars.githubusercontent.com/u/1289096?v=4)](https://github.com/rezgui "rezgui (17 commits)")[![jamesRUS52](https://avatars.githubusercontent.com/u/39707635?v=4)](https://github.com/jamesRUS52 "jamesRUS52 (1 commits)")[![kazak71](https://avatars.githubusercontent.com/u/4598172?v=4)](https://github.com/kazak71 "kazak71 (1 commits)")

---

Tags

laravellaravel-packagelaravel11phplaravelencryptionlumenencryptsourceencrypterioncubeencryptorphpBolt

### Embed Badge

![Health badge](/badges/rezgui-laravel-source-encrypter/health.svg)

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

###  Alternatives

[sbamtr/laravel-source-encrypter

Laravel Source Encrypter

58545.6k](/packages/sbamtr-laravel-source-encrypter)[daanra/laravel-lets-encrypt

A Laravel package to easily generate SSL certificates using Let's Encrypt

22650.9k](/packages/daanra-laravel-lets-encrypt)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

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

AES encrypt and decrypt Eloquent attributes inspired by elocryptfive

171.7k](/packages/dolphiq-laravel-aescrypt)

PHPackages © 2026

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