This GitHub repo contains the following proof of concept:
- Using a static PHP CLI binary, it is possible to compile your PHP files from
.phpto.php.binwith OPcache on any machine which matches your target OS (e.g. macOS) and architecture (e.g. arm64) - You are then able to zero out the
.phpfiles containing your PHP source code - Your app should then be packaged for your target OS and architecture, containing the
.php.binfiles, the empty.phpfiles and the static PHP CLI binary used in step #1 - Upon the app's first boot on the end-user's machine, a command should be run to distribute the
.php.binfiles according to the end-user's unique and absolute paths (you cannot use relative paths with OPcache)
- macOS (arm64 or x86_64)
- Git
- Composer
- PHP ^8.1
$ git clone https://github.com/chrisvpearse/opfuscate-poc.git
$ cd ./opfuscate-poc
$ composer install
$ cp .env.example .env
$ php artisan key:generateThe default web route is the empty ./app/Http/Controllers/HelloWorld.php controller, however, when you launch the web server, you will see a welcome message which is being returned from HelloWorld.php.bin in OPcache's file cache 🎉
$ php artisan opfuscate:install