PHPackages                             machy8/google-closure-compiler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. machy8/google-closure-compiler

ActiveLibrary[API Development](/categories/api)

machy8/google-closure-compiler
==============================

PHP client for the Google Closure Compiler API in one file.

v1.0.1(8y ago)52.1k↑121.4%12New BSD LicensePHPPHP &gt;=7.0

Since Oct 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Machy8/google-closure-compiler)[ Packagist](https://packagist.org/packages/machy8/google-closure-compiler)[ RSS](/packages/machy8-google-closure-compiler/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (2)

Google Closure Compiler
=======================

[](#google-closure-compiler)

[![Build Status](https://camo.githubusercontent.com/d3cc67ff9b16140d189bfeb33c9825eab40a131bdb949936753e2fd655da1a0e/68747470733a2f2f7472617669732d63692e6f72672f4d61636879382f676f6f676c652d636c6f737572652d636f6d70696c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Machy8/google-closure-compiler)[![Coverage Status](https://camo.githubusercontent.com/21d78f2a74c8a193ad86abe28fef182c64ec447ed1d1a74053e4f0e120d04a76/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4d61636879382f676f6f676c652d636c6f737572652d636f6d70696c65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Machy8/google-closure-compiler?branch=master)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/Machy8/google-closure-compiler/blob/master/license.md)

⚡ PHP client for the [Google Closure Compiler](https://closure-compiler.appspot.com/home) API in one file.

Requirements
------------

[](#requirements)

- PHP 7.0+
- If you use Nette Framework - v2.3+

Installation
------------

[](#installation)

**1 - Download the Google Closure Compiler client using composer:**

```
 composer require machy8/google-closure-compiler

```

**2 - Usage:**

*Typical:*

```
$compiler = new GoogleClosureCompiler\Compiler;
$response = $compiler->setJsCode($code)->compile();

if ($response && $response->isWithoutErrors()) {
    echo $response->getCompiledCode();

} else {
    echo $code;
}
```

*Nette framework:*

```
use GoogleClosureCompiler\Compiler;

/**
 * @var Compiler
 */
private $compiler;

public function __construct(Compiler $compiler)
{
    $this->compiler = $compiler;
}

public function renderDefault()
{
    $code = file_get_contents('/path/to/script.js');
    $response = $this->compiler->setJsCode($code)->compile();

    if ($response && $response->isWithoutErrors()) {
        $code = $response->getCompiledCode();
    }

    $this->template->jsCode = $code;
}
```

And in the config neon

```
extensions:
    - GoogleClosureCompiler\Bridges\Nette\GoogleClosureCompilerExtension

```

Usage
-----

[](#usage)

Direct and main information can be found on .

### Compiler

[](#compiler)

Returns [GoogleClosureCompiler\\Response](https://github.com/Machy8/google-closure-compiler/blob/master/src/Compiler/Response.php) if connection was successful otherwise returns NULL. setDefaultStreamContextCreateTimeout

MethodParametersConstantscompileenableClosureCompilerenableStatisticsexcludeDefaultExternssetCodeUrlstring | string \[\] $urlsetCompilationLevelstring $levelCOMPILATION\_LEVEL\_\*setConnectionTimeout int $time  setExternsUrlstring | string\[\] $valuesetFormattingTypestring $typeFORMATTING\_\*setJsCodestring $codesetJsExternsstring $jsCodesetLanguagestring $languageLANGUAGE\_\*setLanguageOutstring $languageLANGUAGE\_OUT\_\*setOutputFileNamestring $namesetWarningLevelstring $levelWARNING\_LEVEL\_\*### Response

[](#response)

Is parsed json from response of previous request.

MethodReturnsgetCompiledCodestring - compiled codegetErrorsarray - errorsgetOutputFilePathstring - url path to filegetResponsestdClass - whole responsegetServerErrorsarray - server errorsgetStatisticsstdClass - statisticsgetWarningsarray - warningshasErrorsbool - if code to compile contains errorshasServerErrorsbool - if response contains server errorshasWarningsbool - if code to compile contains warningsisWithoutErrorsbool - combination of hasServerErrors &amp; hasErrors

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

2

Last Release

3124d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14016808?v=4)[Vladimír Macháček](/maintainers/Machy8)[@Machy8](https://github.com/Machy8)

---

Top Contributors

[![Machy8](https://avatars.githubusercontent.com/u/14016808?v=4)](https://github.com/Machy8 "Machy8 (45 commits)")

---

Tags

apiclosurecompressgooglejavascriptminificationphpphpapijavascriptgooglecompressclosureminification

### Embed Badge

![Health badge](/badges/machy8-google-closure-compiler/health.svg)

```
[![Health](https://phpackages.com/badges/machy8-google-closure-compiler/health.svg)](https://phpackages.com/packages/machy8-google-closure-compiler)
```

###  Alternatives

[gemini-api-php/client

API client for Google's Gemini API

216221.4k5](/packages/gemini-api-php-client)[jeroendesloovere/geolocation-php-api

This Geolocation PHP class connects to Google Maps API to find latitude/longitude or address.

75316.8k4](/packages/jeroendesloovere-geolocation-php-api)[recaptcha/php5

A properly coded PHP 5 reCaptcha class that will allow you to interact with Google's reCaptcha API.

48694.0k4](/packages/recaptcha-php5)[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
