marko9827/phpminify

Minify JS, CSS, HTML string or file

dev-main 2021-12-15 11:00 UTC

This package is auto-updated.

Last update: 2024-05-15 16:51:40 UTC


README

Minify JS, CSS, HTML string or file.

CI

PHP Composer

Very simple. Use this code.

Composer

  1. Install composer
  2. Type composer require marko9827/minify
  3. Enjoy

Usage

 use marko9827\minify\Minify as MinifyMinify;
 
 $content = file_get_contents("$path/file.example"); // .example = .js/.css/.html
 // or
 $content = "var a = 0;  return a + 2;"; //js example
 $content = "body { display: flex; }"; // css example
 $content = "... <body> <div id='example_div'><p>Html Example</p></div>  ..."; // html example

 $minify = new Minify($content);
 echo $minify;
 // or
 echo new Minify($content);

Return minified content

Valid file extensions or MimeTypes

Extension MimeType
js / json text/javascript
js / json application/javascript
css text/style
css text/css
html text/html