nckg / laravel-minify-html
Minify your responses in Laravel 5.x
Installs: 33 104
Dependents: 1
Suggesters: 0
Security: 0
Stars: 14
Watchers: 4
Forks: 6
Open Issues: 2
Requires
- php: ^7.0 || ^8.0
Requires (Dev)
- illuminate/support: ~5.1.0|~5.2.0|~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0
- mockery/mockery: ^0.9.4
- orchestra/testbench: ^3.2
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-10-29 03:48:26 UTC
README
Introduction
Very, very simple html minifier with Laravel 5.x support.
It minifies HTML by
- removing HTML comments except IE conditions
- removing comments
- shorten multiple white spaces
- removing whitespaces between HTML tags
- collapsing new lines
You should end up with a small size profit:
Code Samples
$input = "<a href="/foo" class="bar moo ">Hello World</a>"; $minifier = new Minifier(); $output = $minifier->html($string); // <a href="/foo" class="bar moo ">Hello World</a>
Installation
You can install the package via composer:
composer require nckg/laravel-minify-html
If you are using Laravel you can add the middleware to your middleware providers
// app/Http/Kernel.php /** * The application's global HTTP middleware stack. * * @var array */ protected $middleware = [ ... \Nckg\Minify\Middleware\MinifyResponse::class, ];
Testing
composer test
License
The MIT License (MIT).