PHP code example of rudrax / magicmin

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

    

rudrax / magicmin example snippets




//Default usage will echo from function calls and leave images untouched
$minified = new Minifier();

//Return data without echo
$minified = new Minifier( array( 'echo' => false ) );

//Echo the resulting file path, while base64_encoding images and including as part of css
$minified = new Minifier( array( 'encode' => true ) );

//Return only AND encode/


$exclude = array( 
    'js/autogrow.js', 
    'js/autogrow.min.js', 
    'js/jquery.reveal.js', 
    'js/jquery.reveal.min.js'
);


$exclude_styles = array(
    'css/style.css', 
    'css/style-compressed.min.css'
);


//Only exclude autogrow.js
$exclude = array(
    'js/autogrow.js'
);

//Put jquery and validate before anything else
$order = array(
    'js/jquery.min.js', 
    'js/jquery.validate.js'
);
<script src=" $minified->merge( 'js/magically-ordered.min.js', 'js', 'js', $exclude, $order ); 


$ss/base/jquery.ui.all.css', 
    'css/base/jquery.ui.base.css', 
    'css/base/jquery.ui.spinner.css'
);

$dir = dirname( __FILE__ );
 'echo' => false ) );

<link rel="stylesheet" href=" echo str_replace( $dir, get_bloginfo('template_directory'), $min->merge( $dir . '/css/master.min.css', $dir . '/css', 'css' ) ); 
html
<html>
    <head>
        
         $minified = new Minifier( array( 'gzip' => true, 'timer' => true ) );