gulch / minify
Package for minify and optimize HTML code
Installs: 2 993
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.5
README
gulch/Minify
PHP Package for minify HTML code.
Special Thanks: Funtime Team.
Install
You will need Composer installed.
composer require gulch/minify
How to use
$minifier = gulch\Minify\Minifier::createDefault(); // default optimizations are: whitespaces remove, html comments remove, minification of css and js code // above code is equivalent to: // $minifier = new gulch\Minify\Minifier( // new gulch\Minify\Processor\WhitespacesRemover, // new gulch\Minify\Processor\HtmlCommentsRemover, // new gulch\Minify\Processor\InlineCssMinifier, // new gulch\Minify\Processor\InlineJavascriptMinifier, // ); $minified_code = $minifier->process($code);
Advanced optimizations
$minifier = new gulch\Minify\Minifier( new gulch\Minify\Processor\WhitespacesRemover, new gulch\Minify\Processor\HtmlCommentsRemover, new gulch\Minify\Processor\InlineCssMinifier, new gulch\Minify\Processor\InlineJavascriptMinifier, new gulch\Minify\Processor\AttributesSimplifier, new gulch\Minify\Processor\AttributeQuotesRemover, ); $minified_code = $minifier->process($code);