notihnio / php-cactus
编译并保护您的PHP代码免遭窃取。向客户端服务器部署无风险
1.0.0
2022-09-18 12:32 UTC
Requires
- php: >=8.0
- ext-fileinfo: *
- ext-zend-opcache: *
This package is auto-updated.
Last update: 2024-09-12 00:54:44 UTC
README
保护您的PHP代码免遭窃取。无需担心不拥有服务器即可部署。此库将您的PHP代码编译成opcodes,并从项目中包含的所有PHP文件中删除代码。所有生成的opcode文件都保存在服务器的文件系统中,并由OPcache使用!
之前
index.php
<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
之后
index.php
<?php
//compiled by Cactus
index.php.bin
OPCACHEaa076b0e7a9c60b4d014e9d46754d5ff�ò�ËE"=���h��"`�ÿ�†��8�����˛ˇˇˇ�Ä���˛ˇˇˇ�ġˇˇˇ���w—∑e9�Y�Å���©�—�!��a��°��°��¡��������!��Q��Å��Å��°��°��¡��¡����J�p��=�y
��P�A�J�`����=�y
��P�A�ë�†�Å�]�†�`�u�ê���ÅJ�`����=�◊�P�†�����_�†�P�A�ë�†�Å�È�†@�+�¸�P���I�Ù����"I�Ù��†�/I��⁄�`†�/���‚�`���1p��z
�P1t�G�†1<�⁄�p† 1���‚�p�(�3p��Á�
�84q��G�∞4<�€�ê∞†4����/�†�P4t�G�†4<�”�†�H5p��G�†5<�⁄�Ć�3���‚�p�X�7p��ü�ê�P7B�ü�Ä�`7B�F��7<K��ˇˇˇˇ8>��V�∆èMi…˝8é�/laravel/public/index.phpÈ���1�Q�y��V∆èMi…˝8é�/laravel/public/index.php�VpJįR�Ä�define�VYZ€∂
¨≥î
LARAVEL_START�VÆó‰H—wÉ microtime�VÑÀTñu�ä¿�file_exists�VΩP∂äÔÓSø4/laravel/public/../storage/framework/maintenance.php�Vo~�†∑”5∂&/laravel/public/../vendor/autoload.php�V'†fieE^Ô$/laravel/public/../bootstrap/app.php�V£�ö|�Ä�make�Vfl.`ôå¥öê Illuminate\Contracts\Http\Kernel�Vqÿê�S�Ä�handle!�V⁄ó≤:·†q”�Illuminate\Http\Request�V:¥�ˇi?⁄fl�illuminate\http\request�V9÷ı≤±–Ä�capture�VO€ù|�Ä�send�VÓ ‘=—ŸwÉ terminate�VhÏ1\
有用提示
-
您的PHP文件内容将被替换!请确保您在开发机器上有副本
-
如果想要在编译后更新文件。用更新的文件替换现有的(空文件),然后再次运行PHP cactus
-
opcodes应由创建它们的同一解释器提供。
-
创建包含编译应用程序的Docker镜像是个好主意。您可以通过更新Docker镜像版本来更新应用程序。
安装
使用Composer
composer require notihnio/php-cactus:^1.0
将其添加到php.ini配置中
opcache.enable=1
opcache.enable_cli=1
opcache.validate_timestamps=0
opcache.file_cache = "Enter here the path where the opcodes will be saved"
运行php Cactus
YourProjectRootDir/vendor/bin/cactus
以无提示方式运行php Cactus(强制模式适用于您的部署过程)
YourProjectRootDir/vendor/bin/cactus --noPrompt
为特定项目子目录运行php Cactus(dir参数应相对于项目根目录)
YourProjectRootDir/vendor/bin/cactus --dir app/Controllers