Download the PHP package souravmsh/compressed-output without Composer
On this page you can find all versions of the php package souravmsh/compressed-output. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download souravmsh/compressed-output
More information about souravmsh/compressed-output
Files in souravmsh/compressed-output
Package compressed-output
Short Description Compressed/Optimize output of the laravel application source code
License MIT
Homepage https://github.com/souravmsh/laravel-widget
Informations about the package compressed-output
Laravel Compressed Output Package
The souravmsh/compressed-output
package minifies HTML, CSS, and JavaScript in Laravel applications to improve performance by reducing page load times.
Features
- Minifies inline HTML, CSS, and JavaScript.
- Protects Blade directives, raw Blade content, and conditional comments.
- Preserves jQuery patterns and sensitive JS (e.g., regex/template literals).
- Configurable via
compressed-output.php
.
Installation
-
Install via Composer
Published Repository:
Local Development: Add to
composer.json
:Then:
-
Publish Configuration
Enable in
.env
: - Set Storage Permissions
Configuration
Edit config/compressed-output.php
:
Set COMPRESSED_OUTPUT_ENABLE=true
in .env
to enable the middleware.
How It Works
The CompressedOutputMiddleware
processes text/html
responses:
- Protects: Blade directives (
@...
,{!! !!}
,{{ }}
), inline CSS/JS, and conditional comments. - Minifies:
- HTML: Removes whitespace, non-conditional comments.
- CSS: Removes comments, minimizes spaces, fixes values (e.g.,
32pxauto
→32px auto
). - JS: Removes comments, minimizes spaces, preserves jQuery patterns. Skips
application/json
ortext/template
scripts.
- Headers: Sets
Content-Length
andX-Minified: true
. - Logs: Tracks initial/minified content and skipped scripts.
Example
Original:
Minified:
Verify <script>
tags don’t use type="application/json"
or type="text/template"
.
Limitations
- Regex-based minification may miss complex JS edge cases.
- Only processes inline content, not external files.
- Slight performance overhead; test in production.
Contributing
Submit issues/pull requests to GitHub.
License
Support
Open issues on GitHub or contact the author.