Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
75% | Total: 2,565 This week: 1 | All time: 1,498 This week: 38 |
Version | License | PHP version | Categories | |||
application-packer 0.1.15 | BSD License | 5.4 | PHP 5, Files and Folders, Compression, P... |
Description | Author | |
This package can create packages of minified project files for distribution. |
Encrypt PHP file and run encrypted file on the browser
Encrypt PHP script file
Recommendation for a PHP class to encrypt code
Encrypt PHP source code file including JavaScript
PHP source code protection
I need a class to make the PHP production code harder readable
<?php |
PackApp.php is a complete solution to pack your application's project files into the delivery package. The source code is minified and obfuscated, impeding unauthorized use.
The target audience: ISVs, freelancers, developers, resellers, all who need a lightweight utility to turn the project into the delivery package. The solution is oriented to the PHP applications, but can be used for the front-end projects too.
There are many minifiers, obfuscators, encoders around. Some commercial encoders are very good, but rather expensive and may require system extensions. The others are limited with a single source type only. The Packer is a handy integrated solution.
PackApp.php packs the project files: minifies the source (html, css, js, json, php, xml), obfuscates the code (js, php) and compresses the result files. The source can be either a single file or a folder which may have sub-folders. The destination is a packed file or a folder with the packed files. The ZIP archives are handled also: folder-to-zip, zip-to-folder, zip-to-zip.
The Packer passes the source to according minify plugin depending on the file type. The css and js that detected inside the html are minified too. The html, css and js are looked for the embedded php to minify (except obfuscated js). You can create the user plugins for more file types.
The js and php code can be obfuscated to inhibit its unauthorized use. The reverse engineering of the packed code becomes too expensive. The identifiers replacement algorithm used by the Packer is more protective than trivial applying of the base64_encode and eval. However, you must follow certain naming rules to avoid the renaming conflicts. The php obfuscation is supported by the standard edition.
There are several options to control the processing. Use them for specific cases and rely on defaults mostly. Launch the Packer via the GUI or instantiate and call directly. Various statistics are returned about the processing results. You can display and/or save this data.
The Packer has the free and extended versions. Free version minifies the source and can be launched via instantiation only.
Extended version includes also the GUI and requires the setup (license registration) before using. The extended version has the following editions:
You can obtain the extended version from [here].
The program requires PHP 5.4+. Start it from your script via GUI (except free version) or instantiation (see The package).
The starter script must be in the same directory with the PackApp.php:
require('PackApp.php');
A) Launching the GUI:
echo PackApp::Packer();
B) Instantiation and invocation:
$obj = new PackApp( [$lvl [,$opt]] );
$obj->Pack( $old [,$new [,$rpl]] );
$lvl - processing level, the sum of the following integers:
$opt - the options array:
PHP obfuscation options:
$old - source file/folder/archives
$new -- destination (default by $old value suffixed by sfx option value)
$rpl -- replace destination if exists (default by false)
The $obj->Pack() returns the results associative array:
You can display and/or save the statistics. See example.php about the using.
The files are minified by default and obfuscated (js, php) if required. The php templates are packed for the html, js, css, php. The source file is processed when its type matches one of the following (wildcards allowed);
The rest of the files are simply copied or skipped. Use the pgn option for additional types (see below). The folder or archived source is saved to the destination folder or archived depending on the $new parameter.
The source files of relevant file type are minified by removing the comments, whitespaces and linebreaks. The \htm\ files are checked for the style and script tags which content is minified too. The files (except xml) are checked also for the php tags to pack their content.
The minified source is obfuscated depending on the $lvl parameter value. The JavaScript code is packed into the eval() statement replacing the original identifiers. The PHP obfuscation requires the standard edition.
The package includes the plugins to minify according sources (see The package). You can define your own plugins for additional file types with the pgn option:
['pgn' => ['type' => flag]]
For example:
$obj = new PackApp(1, ['pgn' => ['sql' => false]]);
Place your plugin class into the plugins folder. Make it callable via static minify method like here:
...
public static function minify($source, $options = []) {
$min = new self($options);
return $min->process($source);
}
...
Please [contact] if you would like to include your own plugin(s) into the package.
The standard edition with the PackAppO add-on is required for the PHP obfuscation. It's recommended to follow certain naming rules in the planning and coding stage already to avoid the renaming conflicts (see below).
The php source is processed in two passes. 1st pass registers the identifiers found from the code during the minifying. 2nd pass performs cross-file renaming of the identifiers registered by 1st pass. The following identifiers can be replaced depending on the obf option:
The replacement can be case-insensitive (except variables/properties, heredocs/nowdocs, class constants).
Use the identifiers exclusion list (exi option) and follow the naming rules to avoid the identifiers' replacement conflicts:
These rules are natural to follow and secure from the identifier name collisions. Use the dbg option to fix the renaming issues in the non-minified obfuscated result.
Unzip the obtained package and upload the files to your selected web directory. Then run example.php. The extended version requires the Setup before exploiting. It launches the installer automatically if not set up yet. Run PackApp.php from the browser to launch the installer directly.
The included example minifies/obfuscates the files from the tests.zip and outputs the result into the tests_pkd folder. A message informs about the result. The statistics collected by the packer are displayed and saved into example.txt.
Make a copy from the example.php and try it with different sources, destinations and options. Run index.php to launch the GUI supplied by an extended version.
The extended version supplies the version updates. The About section of the GUI displays the installation and update information and allows to edit your contact data. Run PackApp.php from the browser and click the Update button to check for the updates directly. Your contact data will be used for important product-related messages only. If your contacts change, please edit.
If the updating fails on any reason then the update.php and update.json files created allow to restore - run update.php.
The plugins folder contains the minifiers adapted from the open source. The addons folder is not included in free version. The files list:
Special thanks to the authors referred. Please [contact] for any questions regarding the Packer.
[contact]: mailto://vallo@vregistry.com [here]: http://vregistry.com [Tubal Martin]: https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port [Stephen Clay]: https://github.com/mrclay/minify [Nicolas Martin]: http://joliclic.free.fr/php/javascript-packer/en/ [Ryan Grove]: https://github.com/rgrove/jsmin-php [Tiste]: https://github.com/T1st3/php-json-minify [Kyle Simpson]: https://github.com/getify [GelaMu]: http://php.net/manual/en/function.php-strip-whitespace.php [Vallo Reima]: https://github.com/hareko/php-merge-xml
Files (11) |
File | Role | Description | ||
---|---|---|---|---|
plugins (6 files) | ||||
composer.json | Data | Auxiliary data | ||
example.php | Example | Example script | ||
LICENSE | Lic. | License text | ||
PackApp.php | Class | Class source | ||
README.md | Doc. | Documentation |
Files (11) | / | plugins |
File | Role | Description |
---|---|---|
PackCSS.php | Class | Class source |
PackHTM.php | Class | Class source |
PackJS.php | Class | Class source |
PackJSON.php | Class | Class source |
PackPHP.php | Class | Class source |
PackXML.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
application-packer-2018-02-19.zip 42KB | |
application-packer-2018-02-19.tar.gz 39KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.