Download the PHP package rafalmasiarek/dashboard-kit-addon-compress without Composer
On this page you can find all versions of the php package rafalmasiarek/dashboard-kit-addon-compress. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rafalmasiarek/dashboard-kit-addon-compress
More information about rafalmasiarek/dashboard-kit-addon-compress
Files in rafalmasiarek/dashboard-kit-addon-compress
Package dashboard-kit-addon-compress
Short Description HTML output compression middleware for rafalmasiarek/dashboard-kit. Strips whitespace and comments while preserving script, pre and textarea blocks.
License BUSL-1.1
Informations about the package dashboard-kit-addon-compress
dashboard-kit-addon-compress
HTML output compression middleware for rafalmasiarek/dashboard-kit.
Collapses whitespace and strips HTML comments from every text/html response. Sensitive blocks (<script>, <style>, <pre>, <textarea>) are preserved verbatim.
Installation
Requires PHP 8.2+, slim/slim ^4, and slim/psr7 ^1.
Usage
Configure the addon in Dashboard::create() under the compress key, then register it:
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
enabled |
bool |
true |
Set to false to disable compression entirely (e.g. on dev) |
exclude |
string[] |
[] |
Request paths matching any pattern pass through unmodified |
exclude supports two pattern types:
What gets compressed
- Whitespace between adjacent tags (
> <→><) - Runs of two or more whitespace characters collapsed to a single space
- HTML comments stripped (except IE conditional comments
<!--[if ...]>)
What is preserved
The following blocks are extracted before compression and restored afterwards — their content is never modified:
| Block | Reason |
|---|---|
<script>...</script> |
JavaScript is whitespace-sensitive |
<style>...</style> |
CSS is whitespace-sensitive |
<pre>...</pre> |
Preformatted text, whitespace is meaningful |
<textarea>...</textarea> |
User-visible whitespace |
Opting out of compression
Wrap any section of HTML with <!-- compress:off --> / <!-- compress:on --> to exclude it from compression:
The entire block (including the directive comments) is preserved byte-for-byte. Any <script> or <style> tags inside a compress:off block are also preserved as part of that block and are not separately extracted.
Content-type filtering
Only responses where Content-Type contains text/html are processed. JSON, redirects (empty body), binary assets, and all other response types pass through untouched.
License
Business Source License 1.1 — see LICENSE. For alternative licensing, contact us.
All versions of dashboard-kit-addon-compress with dependencies
rafalmasiarek/dashboard-kit Version *
slim/slim Version ^4
slim/psr7 Version ^1