PHPackages                             aflorea4/laravel-source-obfuscator - 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. aflorea4/laravel-source-obfuscator

ActiveLibrary[Security](/categories/security)

aflorea4/laravel-source-obfuscator
==================================

A Laravel package for source code obfuscation using PHPBolt extension

v1.1.1(4mo ago)135↓46.7%MITPHPPHP ^7.4|^8.0CI failing

Since Jan 6Pushed 4mo agoCompare

[ Source](https://github.com/aflorea4/laravel-source-obfuscator)[ Packagist](https://packagist.org/packages/aflorea4/laravel-source-obfuscator)[ Docs](https://github.com/aflorea4/laravel-source-obfuscator)[ GitHub Sponsors](https://github.com/aflorea4)[ RSS](/packages/aflorea4-laravel-source-obfuscator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (9)Used By (0)

Laravel Source Code Obfuscator
==============================

[](#laravel-source-code-obfuscator)

A comprehensive Laravel package for source code obfuscation using PHPBolt. Protect your Laravel application's source code with advanced obfuscation techniques, perfect for CI/CD pipelines and deployment workflows.

[![Latest Version on Packagist](https://camo.githubusercontent.com/525c71ca09a417c221a5bbaaaa6693e6a17a81d271583cd85217945296cc7bc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61666c6f726561342f6c61726176656c2d736f757263652d6f626675736361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aflorea4/laravel-source-obfuscator)[![Total Downloads](https://camo.githubusercontent.com/f5171b7fba0f3737734ddae1985b30657b5a2f3f1ebe72b1937072da98cf4afb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61666c6f726561342f6c61726176656c2d736f757263652d6f626675736361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aflorea4/laravel-source-obfuscator)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/bd2b103b0a20a0f5b1af35e3e9f1db50dda4cfcda8b01624e2a37206c26ec5bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/3fbd199595752957e8dcac71b2756d160598faacd468d2dcb47369475f29f650/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d253345253344382e302d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

Features
--------

[](#features)

- 🔒 **PHPBolt Integration** - Uses PHPBolt engine for professional-grade obfuscation
- ⚙️ **Highly Configurable** - Extensive configuration options for fine-tuned control
- 📁 **Smart File Selection** - Include/exclude patterns for precise file targeting
- 🔄 **Automatic Backups** - Create backups before obfuscation with rotation
- 🚀 **CI/CD Ready** - Designed for seamless integration into deployment pipelines
- 📊 **Detailed Reporting** - Generate comprehensive obfuscation reports
- 🎯 **Multiple Commands** - CLI commands for various obfuscation tasks
- ⚡ **Performance Optimized** - Parallel processing support for large codebases
- 🛡️ **Safe Operation** - Dry-run mode and validation checks

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel &gt;= 8.0 (8.x, 9.x, 10.x, 11.x, 12.x)
- PHPBolt extension (`bolt.so`) - [Get it here](https://github.com/arshidkv12/phpBolt)

Installation
------------

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require aflorea4/laravel-source-obfuscator
```

### 2. Install PHPBolt Extension

[](#2-install-phpbolt-extension)

PHPBolt is a free PHP extension for code obfuscation. Install the `bolt.so` extension:

```
# Download bolt.so for your PHP version from https://github.com/arshidkv12/phpBolt
# Or use the provided installation script

# Copy to PHP extensions directory
sudo cp bolt.so $(php-config --extension-dir)/

# Enable the extension
echo "extension=bolt.so" | sudo tee /etc/php/$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')/mods-available/bolt.ini
sudo phpenmod bolt

# Restart PHP-FPM
sudo systemctl restart php$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')-fpm

# Verify installation
php -m | grep bolt
```

**Note:** The extension must be loaded both during obfuscation AND at runtime in production.

### 3. Publish Configuration

[](#3-publish-configuration)

```
php artisan vendor:publish --provider="Aflorea4\LaravelSourceObfuscator\ObfuscatorServiceProvider" --tag="config"
```

This will create `config/obfuscator.php` in your Laravel application.

### 4. Configure Encryption Key

[](#4-configure-encryption-key)

Edit `.env` file and add:

```
# Encryption key (leave empty to auto-generate)
PHPBOLT_KEY=

# OR set a specific key (min 6 characters)
PHPBOLT_KEY=your-secret-key-here

# Output directories
OBFUSCATOR_OUTPUT_DIR=production/obfuscated
OBFUSCATOR_BACKUP_DIR=backups/pre-obfuscation
```

**Important:** The encryption key will be shown after obfuscation. You must set it as `PHP_BOLT_KEY` constant in production.

Runtime Configuration (Production)
----------------------------------

[](#runtime-configuration-production)

After obfuscating your code, you need to configure your production environment:

### 1. Install bolt.so Extension in Production

[](#1-install-boltso-extension-in-production)

```
# The bolt.so extension MUST be installed in production
sudo cp bolt.so $(php-config --extension-dir)/
echo "extension=bolt.so" | sudo tee /etc/php/8.2/mods-available/bolt.ini
sudo phpenmod bolt
sudo systemctl restart php8.2-fpm
```

### 2. Define PHP\_BOLT\_KEY Constant

[](#2-define-php_bolt_key-constant)

Add to your `public/index.php` or bootstrap file:

```
