PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 217 This week: 1All time: 8,293 This week: 560Up
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.

Picture of Marco Cesarato
  Performance   Level  
Name: Marco Cesarato is available for providing paid consulting. Contact Marco Cesarato .
Classes: 9 packages by
Country: Italy Italy
Age: 28
All time rank: 133654 in Italy Italy
Week rank: 411 Up18 in Italy Italy Up
Innovation award
Innovation award
Nominee: 2x

Documentation

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:217
This week:1
All time:8,293
This week:560Up