The Closure Compiler compiles JavaScript into compact, high-performance code.
ClosureCompilerPHP works with PHP 5.3 or later.
<?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();
The tests use PHPUnit