ivandmitry7777/php-cactus

编译并保护您的PHP代码不被窃取。无风险部署到客户端服务器

v1.0 2023-07-31 01:34 UTC

This package is not auto-updated.

Last update: 2024-09-23 08:04:26 UTC


README

保护您的PHP代码不被窃取。无需担忧服务器所有权即可部署。此库将您的PHP代码编译为操作码,并从项目中包含的所有PHP文件中删除代码。所有生成的操作码文件都保存在服务器文件系统中,并由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

  • 操作码应由创建它们的相同解释器提供。

  • 创建包含编译应用程序的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