neeckeloo / closure-compiler-php
Closure Compiler 能够将 JavaScript 编译成紧凑、高性能的代码。
dev-master
2016-03-12 16:25 UTC
Requires
- php: >=5.3.0
- zendframework/zend-http: 2.*
This package is auto-updated.
Last update: 2024-09-06 08:53:59 UTC
README
Closure Compiler 能够将 JavaScript 编译成紧凑、高性能的代码。
要求
ClosureCompilerPHP 支持 PHP 5.3 及更高版本。
使用方法
基本使用
<?php $compiler = new RemoteCompiler(); $compiler->addScript('var a = "hello"; alert(a);'); $response = $compiler->compile(); $compiledCode = $response->getCompiledCode();
文件编译
<?php $compiler = new RemoteCompiler(); $compiler->addLocalFile(__DIR__ . '/script.js'); $response = $compiler->compile(); $compiledCode = $response->getCompiledCode();
运行测试
测试使用 PHPUnit