PHP Classes
elePHPant
Icontem

PHP Minify HTML, CSS, JS: Shrink HTML, JavaScript and CSS to take less space

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-09-10 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 170 All time: 8,551 This week: 328Up
Version License PHP version Categories
code-minfier 1.0.3Free for non-comm...5PHP 5, Compression, Parsers
Description Author

This class can minify HTML, JavaScript and CSS to take less space.

It can take a string with either HTML, JavaScript or CSS, and parses it to eliminate unnecessary text.

The class returns as result a a string that is smaller than the original.

  Performance   Level  
Name: Marco Cesarato is available for providing paid consulting. Contact Marco Cesarato .
Classes: 8 packages by
Country: Italy Italy
Age: 23
All time rank: 199878 in Italy Italy
Week rank: 45 Up2 in Italy Italy Up
Innovation award
Innovation award
Nominee: 1x

 

Details

PHP Minifier

Version: 0.1.5 beta

Github: https://github.com/marcocesarato/PHP-Minifier

Author: Marco Cesarato

Description

This class can minify HTML, JavaScript and CSS to take less space.

It can take a string with either HTML, JavaScript or CSS, and parses it to eliminate unnecessary text.

The class returns as result a a string that is smaller than the original.

Requirements

  • php 4+

Install

Composer

  1. Install composer
  2. Type composer require marcocesarato/minifier
  3. Enjoy

Usage

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;

Methods

Minifier

| Method | Parameters | Description | | ----------- | ----------------------------------- | -------------------------------------------------- | | minifyJS | $javascript<br>return string | Minify Javascript | | minifyCSS | $css<br>return string | Minify CSS | | minifyHTML | $html<br>return string | Minify HTML |

  Files folder image Files  
File Role Description
Accessible without login Plain text file LICENSE Lic. License text
Plain text file Minifier.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:170
This week:0
All time:8,551
This week:328Up