PHPackages                             wyrihaximus/react-http-middleware-compress-assets - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. wyrihaximus/react-http-middleware-compress-assets

ActiveLibrary[HTTP &amp; Networking](/categories/http)

wyrihaximus/react-http-middleware-compress-assets
=================================================

react/http middleware that compresses JS/CSS response bodies

2.1.1(3y ago)39.7k1[2 issues](https://github.com/WyriHaximus/reactphp-http-middleware-compress-assets/issues)[2 PRs](https://github.com/WyriHaximus/reactphp-http-middleware-compress-assets/pulls)MITPHPPHP ^8 || ^7.4

Since Jan 17Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/WyriHaximus/reactphp-http-middleware-compress-assets)[ Packagist](https://packagist.org/packages/wyrihaximus/react-http-middleware-compress-assets)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-react-http-middleware-compress-assets/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (7)Versions (9)Used By (0)

Middleware that compresses CSS/JS response bodies
=================================================

[](#middleware-that-compresses-cssjs-response-bodies)

[![Build Status](https://camo.githubusercontent.com/6ec3068bd38122d2bdcff285040c3e64a042c1733d0ecfd6944ecdee8ca73c53/68747470733a2f2f7472617669732d63692e6f72672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d636f6d70726573732d6173736574732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-compress-assets)[![Latest Stable Version](https://camo.githubusercontent.com/14e3f6e9b5540ccf24201d104d60a79799bee83061b4228f1cc489c2b3a70329/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d636f6d70726573732d6173736574732f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-compress-assets)[![Total Downloads](https://camo.githubusercontent.com/1c87d48cc4d8be140d89c37df3eccf30e78427e9dd42972cbe7cbedb1f89e09e/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d636f6d70726573732d6173736574732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-compress-assets)[![Code Coverage](https://camo.githubusercontent.com/910e36f5af9ed763eac3ac0b82b469a5e9f7fa30d8b7a6b6ad24c25b06aebc2f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d636f6d70726573732d6173736574732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-compress-assets/?branch=master)[![License](https://camo.githubusercontent.com/c06588e64e2957ab2151a6e9a57b8c506a80c8adcf891dbd8b1424386dc39dd4/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d636f6d70726573732d6173736574732f6c6963656e73652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-compress-assets)[![PHP 7 ready](https://camo.githubusercontent.com/42718cddeb81248571079e9a79343ed0f98fbc659d6f1cf0bbf642e84f6d6cbf/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d636c6561722d626f64792f62616467652e737667)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-clear-body)

Install
=======

[](#install)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.

```
composer require wyrihaximus/react-http-middleware-compress-assets

```

This middleware removes the raw body from the request. Best used after the request body has been parsed.

Usage
=====

[](#usage)

```
$server = new Server([
    /** Other Middleware */
    new CssCompressMiddleware(),
    new JsCompressMiddleware(),
    /** Other Middleware */
]);
```

Optionally an instance of `WyriHaximus\HtmlCompress\Parser` is accepted as first constructor argument. The default uses a very simple but fast compressor that only compresses HTML. The following example goes for the smallest possible size:

```
use WyriHaximus\HtmlCompress\Factory;

$server = new Server([
    /** Other Middleware */
    new CssCompressMiddleware(Factory::constructSmallest()),
    new JsCompressMiddleware(Factory::constructSmallest()),
    /** Other Middleware */
]);
```

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2018 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~486 days

Total

4

Last Release

1262d ago

Major Versions

1.0.0 → 2.0.02020-10-02

PHP version history (2 changes)1.0.0PHP ^7.0

2.1.0PHP ^8 || ^7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (11 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![makeey](https://avatars.githubusercontent.com/u/23615966?v=4)](https://github.com/makeey "makeey (1 commits)")

---

Tags

hacktoberfest

### Embed Badge

![Health badge](/badges/wyrihaximus-react-http-middleware-compress-assets/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-react-http-middleware-compress-assets/health.svg)](https://phpackages.com/packages/wyrihaximus-react-http-middleware-compress-assets)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B3.8k](/packages/guzzlehttp-psr7)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

43.2k341.0k1](/packages/ccxt-ccxt)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k34](/packages/neuron-core-neuron-ai)[discord-php/http

Handles HTTP requests to Discord servers

24360.3k12](/packages/discord-php-http)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
