PHP code example of marcocesarato / minifier

1. Go to this page and download the library: Download marcocesarato/minifier 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/ */

    

marcocesarato / minifier example snippets


ob_start();

$html = <<<EOD
<html>
<head>
    <title>Hello World</title>
</head>
<body>
    <h1>Hello World</h1>
</body>
</html>
EOD;

echo $html;

$content = ob_get_contents();
ob_clean();

$minifier = new Minifier();
$min_html = $minifier->minifyHTML($content);

echo $min_html;