定制 tholu/php-packer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tholu/php-packer

最新稳定版本:0.2.0

Composer 安装命令:

composer require tholu/php-packer

包简介

A PHP version of Packer, JavaScript obfuscation library originally created by Dean Edwards

README 文档

README

A PHP version of Packer, JavaScript obfuscation library originally created by Dean Edwards, ported to PHP by Nicolas Martin. Packed for composer and slightly extended by Thomas Lutz.

Installation

Simply run composer require tholu/php-packer.

Usage (slightly changed from previous used implementation!)

<?php
require 'vendor/autoload.php';

$js = file_get_contents('test.js');

/*
 * params of the constructor :
 * $script:           the JavaScript to pack, string.
 * $encoding:         level of encoding, int or string :
 *                    0,10,62,95 or 'None', 'Numeric', 'Normal', 'High ASCII'.
 *                    default: 62 ('Normal').
 * $fastDecode:       include the fast decoder in the packed result, boolean.
 *                    default: true.
 * $specialChars:     if you have flagged your private and local variables
 *                    in the script, boolean.
 *                    default: false.
 * $removeSemicolons: whether to remove semicolons from the source script.
 *                    default: true.
 */

// $packer = new Tholu\Packer\Packer($script, $encoding, $fastDecode, $specialChars, $removeSemicolons);
$packer = new Tholu\Packer\Packer($js, 'Normal', true, false, true);
$packed_js = $packer->pack();
echo $packed_js;

UTF8

If you have UTF8 characters in your JavaScript like here, avoid using the "High ASCII" encoding and use "Normal" instead. Also make sure, that the file is saved and read with proper UTF8 encoding.

统计信息

  • 总下载量: 423.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 144
  • 点击次数: 1
  • 依赖项目数: 8
  • 推荐数: 1

GitHub 信息

  • Stars: 139
  • Watchers: 13
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-04