PHP code example of middlewares / minifier

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

    

middlewares / minifier example snippets


Dispatcher::run([
    Middlewares\Minifier::html(),
    Middlewares\Minifier::css(),
    Middlewares\Minifier::js(),
]);

use WyriHaximus\HtmlCompress\Factory;

$compressor = Factory::construct();
$mimeType = 'text/html';

$minifier = new Middlewares\Minifier($compressor, $mimeType);

$streamFactory = new MyOwnStreamFactory();

$minifier = new Middlewares\Minifier($compressor, $mimeType, $streamFactory);

$htmlMinifier = Middlewares\Minifier::html();
$cssMinifier = Middlewares\Minifier::css();
$jsMinifier = Middlewares\Minifier::js();