jszczypk/google-closure-compiler

Interface to Google Closure Compiler

Maintainers

Package info

github.com/jszczypk/GoogleClosureCompiler

pkg:composer/jszczypk/google-closure-compiler

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-03 02:55 UTC

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
);