jszczypk / google-closure-compiler
Interface to Google Closure Compiler
Package info
github.com/jszczypk/GoogleClosureCompiler
pkg:composer/jszczypk/google-closure-compiler
v1.0.0
2026-03-03 02:55 UTC
Requires
- php: >=8.1
- ext-curl: *
This package is auto-updated.
Last update: 2026-03-03 03:00:55 UTC
README
A simple PHP wrapper for Google Closure Compiler.
Installation
composer require jszczypk/google-closure-compiler
Setup
Requires PHP 8.1+ and the curl extension (for remote compilation).
For local compilation, you need Node and npm package google-closure-compiler.
Usage
use JSzczypk\GoogleClosureCompiler\Compiler; use JSzczypk\GoogleClosureCompiler\CompilationLevel; $compiler = new Compiler( compilationLevel: CompilationLevel::SIMPLE_OPTIMIZATIONS ); $yourJavaScriptCode = 'console.log("Hello World!");'; $compiledCode = $compiler->compile($yourJavaScriptCode);
Advanced Usage
You can customize LanguageIn and LanguageOut:
use JSzczypk\GoogleClosureCompiler\Compiler; use JSzczypk\GoogleClosureCompiler\LanguageIn; use JSzczypk\GoogleClosureCompiler\LanguageOut; use JSzczypk\GoogleClosureCompiler\CompilationLevel; $compiler = new Compiler( compilationLevel: CompilationLevel::ADVANCED_OPTIMIZATIONS, languageIn: LanguageIn::ECMASCRIPT_NEXT, languageOut: LanguageOut::ECMASCRIPT5 );