2017 © Pedro Peláez
 

library phpcc

A PHP Library to use Google Closure Compiler compress Javascript

image

tureki/phpcc

A PHP Library to use Google Closure Compiler compress Javascript

  • Wednesday, November 25, 2015
  • by tureki
  • Repository
  • 3 Watchers
  • 15 Stars
  • 1,045 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

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., (*1)

Installation

You can install the library with composer or manually., (*2)

Composer

Step 1. Edit your composer.json:, (*3)

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

Step 2. Install it:, (*4)

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

Manually From Release

Step 1. Download the latest release, (*5)

Step 2. Include the library:, (*6)

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

How to use

Download phpcc Library. and then require phpcc.class.php in your .php file. You can test sample.php in samples folder., (*7)

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., (*8)

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, (*9)


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

print_r($phpcc->help());

How to compress

Add jQuery file and combined compression to one file., (*11)

$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., (*12)

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

Use single() can individual compression., (*13)

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

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




---- You can also mixed. ```php $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., (*15)

$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

a. Add Unit Test b. Integrate CI, (*16)

Authors

tureki, (*17)

Copyright 2013 tureki, under MIT License., (*18)

The Versions

25/11 2015

dev-master

9999999-dev

A PHP Library to use Google Closure Compiler compress Javascript

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php compress closure compiler

25/11 2015

dev-develop

dev-develop

A PHP Library to use Google Closure Compiler compress Javascript

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php compress closure compiler

25/11 2015

v1.0.5

1.0.5.0

A PHP Library to use Google Closure Compiler compress Javascript

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php compress closure compiler

27/06 2014

v1.0.0

1.0.0.0

A PHP Library to use Google Closure Compiler compress Javascript

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0

 

php compress closure compiler