1. Go to this page and download the library: Download axy/min-html 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/ */
axy / min-html example snippets
use axy\min\html\HTMLMinifier;
$source = 'index.html';
$destination = 'index.min.html';
HTMLMinifier::compressFile($source, $destination);
$min = new HTMLMinifier($content);
$min->run();
echo $min->getCompressedContent();
[
'pre' => true,
'textarea' => true,
]
$tags = [
'script' => function ($content) {
return JSMinify::minify($content);
},
'textarea' => null, // Remove rule for TEXTAREA
'style' => true, // Content of STYLE does not change
];
HTMLMinifier::compressFile($source, $destination, $tags);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.