renaatdemuynck / php-yui-compressor
This package is abandoned and no longer maintained.
The author suggests using the jalle19/php-yui-compressor package instead.
A PHP wrapper for the YUI Compressor
v0.1.0
2014-02-15 17:14 UTC
This package is not auto-updated.
Last update: 2019-02-20 17:49:38 UTC
README
This simple wrapper class can be used to compress CSS and JavaScript files using the YUI Compressor. The YUI Compressor jar file is included in the package. For more info, visit yui.github.io/yuicompressor.
Installation
You can install this library using Composer. For Composer documentation, please refer to getcomposer.org.
composer require renaatdemuynck/php-yui-compressor:0.*
Usage
To compress a stylesheet:
<?php
use Rdm\YuiCompressor;
$compressor = new YuiCompressor(YuiCompressor::TYPE_CSS);
$compressor->compress('/* comment */ div {display: block; }');
This will return:
'div{display:block}'
To compress JavaScript:
<?php
use Rdm\YuiCompressor;
$compressor = new YuiCompressor(YuiCompressor::TYPE_JS);
$compressor->compress('var x = 1 + 2; console.log(x);');
This will return:
'var x=1+2;console.log(x)'
To do list
- Add options for compressor
- Better error handling
- ...