All Projects → tureki → php-closure-compiler

tureki / php-closure-compiler

Licence: other
A PHP Library to use Google Closure Compiler compress Javascript

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-closure-compiler

Compression
Node.js compression middleware
Stars: ✭ 2,506 (+12430%)
Mutual labels:  compression
Gdcm
Grassroots DICOM read-only mirror. Only for Pull Request. Please report bug at http://sf.net/p/gdcm
Stars: ✭ 240 (+1100%)
Mutual labels:  compression
GenuineChannels
Collection of custom .NET Remoting channels
Stars: ✭ 29 (+45%)
Mutual labels:  compression
Nncf
PyTorch*-based Neural Network Compression Framework for enhanced OpenVINO™ inference
Stars: ✭ 218 (+990%)
Mutual labels:  compression
Smol V
SMOL-V: like Vulkan/Khronos SPIR-V, but smaller.
Stars: ✭ 230 (+1050%)
Mutual labels:  compression
Precomp Cpp
Precomp, C++ version - further compress already compressed files
Stars: ✭ 250 (+1150%)
Mutual labels:  compression
Deepinfomaxpytorch
Learning deep representations by mutual information estimation and maximization
Stars: ✭ 212 (+960%)
Mutual labels:  compression
FrameOfReference
C++ library to pack and unpack vectors of integers having a small range of values using a technique called Frame of Reference
Stars: ✭ 36 (+80%)
Mutual labels:  compression
Minlzma
The Minimal LZMA (minlzma) project aims to provide a minimalistic, cross-platform, highly commented, standards-compliant C library (minlzlib) for decompressing LZMA2-encapsulated compressed data in LZMA format within an XZ container, as can be generated with Python 3.6, 7-zip, and xzutils
Stars: ✭ 236 (+1080%)
Mutual labels:  compression
ConvectionKernels
Fast, high-quality texture compression library for many formats
Stars: ✭ 40 (+100%)
Mutual labels:  compression
Cineform Sdk
The GoPro® CineForm video codec SDK.
Stars: ✭ 219 (+995%)
Mutual labels:  compression
Zipson
JSON parse and stringify with compression
Stars: ✭ 229 (+1045%)
Mutual labels:  compression
em inflate
Fast, small, in-memory inflate (zlib, deflate and gzip decompression)
Stars: ✭ 59 (+195%)
Mutual labels:  compression
Bedops
🔬 BEDOPS: high-performance genomic feature operations
Stars: ✭ 215 (+975%)
Mutual labels:  compression
pybashutils
Collection of Bash and Python scripts I've made that may be generally useful
Stars: ✭ 26 (+30%)
Mutual labels:  compression
7zip4powershell
Powershell module for creating and extracting 7-Zip archives
Stars: ✭ 213 (+965%)
Mutual labels:  compression
Compressai
A PyTorch library and evaluation platform for end-to-end compression research
Stars: ✭ 246 (+1130%)
Mutual labels:  compression
Guetzling
Guetzling is a simple script for macOS and Linux written in Bash, to automate (recursively finding files) the compression of jpegs using the Guetzli algorithm.
Stars: ✭ 20 (+0%)
Mutual labels:  compression
roadroller
Roadroller: Flattens Your JavaScript Demo
Stars: ✭ 253 (+1165%)
Mutual labels:  compression
Huffman-Coding
A C++ compression program based on Huffman's lossless compression algorithm and decoder.
Stars: ✭ 81 (+305%)
Mutual labels:  compression

##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.

##Installation

You can install the library with composer or manually.

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

Step 1. Download the latest release

Step 2. Include the library:

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.

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


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

print_r($phpcc->help());

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

a. Add Unit Test b. Integrate CI

Authors

tureki

Copyright and License

Copyright 2013 tureki, under MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].