marko9827 / phpminify
Minify JS, CSS, HTML string or file
dev-main
2021-12-15 11:00 UTC
Requires
- php: >=4.0.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/test-pack: ^1.0
- symfony/web-server-bundle: ^4.4
This package is auto-updated.
Last update: 2024-05-15 16:51:40 UTC
README
Minify JS, CSS, HTML string or file.
Very simple. Use this code.
Composer
- Install composer
- Type
composer require marko9827/minify
- 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 |