PHP code example of wikimedia / minify
1. Go to this page and download the library: Download wikimedia/minify library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wikimedia / minify example snippets
use Wikimedia\Minify\JavaScriptMinifier;
$input = '
/**
* @param a
* @param b
*/
function sum(a, b) {
// Add it up!
return a + b;
}
';
$output = JavaScriptMinifier::minify( $input );
// Result:
// function sum(a,b){return a+b;}
use Wikimedia\Minify\CSSMin;
$input = '
.foo,
.bar {
/* comment */
prop: value;
}
';
$output = CSSMin::minify( $input );
// Result:
// .foo,.bar{prop:value}