PHPackages                             tureki/phpcc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tureki/phpcc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tureki/phpcc
============

A PHP Library to use Google Closure Compiler compress Javascript

v1.0.5(10y ago)202.7k6MITPHPPHP &gt;=5.3.0

Since Jun 27Pushed 7y ago4 watchersCompare

[ Source](https://github.com/tureki/php-closure-compiler)[ Packagist](https://packagist.org/packages/tureki/phpcc)[ RSS](/packages/tureki-phpcc/feed)WikiDiscussions develop Synced 1w ago

READMEChangelog (1)DependenciesVersions (4)Used By (0)

\##PHP Closure Compiler

**phpcc** is a PHP Library to use Google Closure Compiler compress Javascript. You can view information about Google Closure Compiler on this [link](https://developers.google.com/closure/compiler/).

\##Installation

You can install the library with composer or manually.

#### Composer

[](#composer)

Step 1. Edit your `composer.json`:

```
{
    "require": {
        "tureki/phpcc": ">=1.0.5"
    }
}
```

Step 2. Install it:

```
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
```

#### Manually From Release

[](#manually-from-release)

Step 1. [Download the latest release](https://github.com/tureki/php-closure-compiler/releases)

Step 2. Include the library:

```
require_once '[path to phpcc]/phpcc.php';
```

How to use
----------

[](#how-to-use)

Download **phpcc** Library. and then require `phpcc.class.php` in your `.php` file. You can test `sample.php` in `samples` folder.

```
require '../src/phpcc.php';

$phpcc = new tureki\PhpCc(array(
	'java_file'    => 'YOUR JAVA FILE PATH',
	'jar_file'     => '../src/compiler/compiler.jar',
	'output_path'  => './output/',
	'optimization' => 'SIMPLE_OPTIMIZATIONS'
));
```

---

`java_file` is system java execute file path.

```
Example:
-   Linux:"/usr/lib/jvm/jre-1.6.0/bin/java"
-   Window7:"C:\Program Files (x86)\Java\jre6\bin\java"
```

---

`jar_file` is Google Closure Compiler jar file. Your can download latest version on this [link](http://code.google.com/p/closure-compiler/wiki/BinaryDownloads)

---

After setting. use `help()` method to test **phpcc**.

```
print_r($phpcc->help());
```

How to compress
---------------

[](#how-to-compress)

Add jQuery file and combined compression to one file.

```
$ary_result = $phpcc
                ->add("js/jquery-1.10.2.js")
                ->add("js/1.9/jquery-1.9.1.js")
                ->exec("all.js");
print_r($ary_result);
```

---

Set Directory path find `.js` file and combined compression to one file.

```
$ary_result = $phpcc
                ->setDir("./js")
                ->exec("all.js");
print_r($ary_result);
```

---

Use `single()` can individual compression.

```
$ary_result = $phpcc
                ->add("js/jquery-1.10.2.js")
                ->add("js/1.9/jquery-1.9.1.js")
                ->single()
                ->exec();
print_r($ary_result);
```

```
$ary_result = $phpcc
                ->setDir("./js")
                ->single()
                ->exec();
print_r($ary_result);
```

---

You can also mixed.

```
$ary_result = $phpcc
                ->add("js/jquery-1.10.2.js")
                ->add("js/1.9/jquery-1.9.1.js")
                ->setDir("./js")
                ->single()
                ->exec();
print_r($ary_result);
```

---

You can use `param()` add Closure Compiler command param.

```
$ary_result = $phpcc
                ->add("js/jquery-1.10.2.js")
                ->param("--angular_pass")
                ->param("--formatting","PRETTY_PRINT")
                ->exec("all.js");
print_r($ary_result);
```

Todo
----

[](#todo)

a. Add Unit Test b. Integrate CI

Authors
-------

[](#authors)

**tureki**

-

Copyright and License
---------------------

[](#copyright-and-license)

Copyright 2013 tureki, under [MIT License](http://opensource.org/licenses/MIT).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~515 days

Total

2

Last Release

3827d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/289419?v=4)[Kah Wai Liew](/maintainers/tureki)[@tureki](https://github.com/tureki)

---

Top Contributors

[![tureki](https://avatars.githubusercontent.com/u/289419?v=4)](https://github.com/tureki "tureki (35 commits)")

---

Tags

closure-compilercompressionphpphp-libraryphpcompressclosure-compiler

### Embed Badge

![Health badge](/badges/tureki-phpcc/health.svg)

```
[![Health](https://phpackages.com/badges/tureki-phpcc/health.svg)](https://phpackages.com/packages/tureki-phpcc)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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