PHPackages                             wyrihaximus/react-http-middleware-webroot-preload - 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-webroot-preload

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

wyrihaximus/react-http-middleware-webroot-preload
=================================================

react/http middleware static webroot serving

3.0.0(5mo ago)921.0k↑81.3%5[5 issues](https://github.com/WyriHaximus/reactphp-http-middleware-webroot-preload/issues)[5 PRs](https://github.com/WyriHaximus/reactphp-http-middleware-webroot-preload/pulls)MITMakefilePHP ^8.4CI passing

Since Dec 13Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/WyriHaximus/reactphp-http-middleware-webroot-preload)[ Packagist](https://packagist.org/packages/wyrihaximus/react-http-middleware-webroot-preload)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-react-http-middleware-webroot-preload/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (27)Used By (0)

A static preloaded webroot middleware for react/http
====================================================

[](#a-static-preloaded-webroot-middleware-for-reacthttp)

[![Continuous Integration](https://github.com/WyriHaximus/react-http-middleware-webroot-preload/workflows/Continuous%20Integration/badge.svg)](https://github.com/WyriHaximus/react-http-middleware-webroot-preload/workflows/Continuous%20Integration/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/bc89e39ef53a7a10caa8c75a1c2ee21430adeecef64406035b3d307094e1cfb3/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d776562726f6f742d7072656c6f61642f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-webroot-preload)[![Total Downloads](https://camo.githubusercontent.com/bb0efac4d69ce7592fc96ce1b65ec88f7494ce62c9de44c5703018a3f29d872b/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d776562726f6f742d7072656c6f61642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-webroot-preload)[![Code Coverage](https://camo.githubusercontent.com/3966f559e6d6e254927a56ea33931804594526813057e213e1e778705ec89ca5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d776562726f6f742d7072656c6f61642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-webroot-preload/?branch=master)[![License](https://camo.githubusercontent.com/b193045f79e41e7a897a1556cc5b1f978f9ec719fa0410502e2b19a42374126f/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d776562726f6f742d7072656c6f61642f6c6963656e73652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-webroot-preload)[![PHP 7 ready](https://camo.githubusercontent.com/4ba5feee84cb8ac66ed78e37a6629df5b11ce7f02e34f42cb46f7f3dadac1f99/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d776562726f6f742d7072656c6f61642f62616467652e737667)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-webroot-preload)

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-webroot-preload

```

Usage
=====

[](#usage)

The middleware accepts two parameters, first the webroot directory, and secondly an optional PSR-3 logger. It is important to note that ALL files in the webroot will be served regardless of file type. So no PHP or files containing passwords etc etc should be in there.

```
$webroot = '/var/www/';
$logger = new Psr3Logger(); // Require, PSR-3 logger for bootstrap logging
$cache = new ArrayCache();  // Required, custom cache configuration
$server = new Server([
    /** Other middleware */
    new WebrootPreloadMiddleware($webroot, $logger, $cache),
    /** Other middleware */
]);
```

Out of process caching
----------------------

[](#out-of-process-caching)

Internally this package uses a readonly DTO to store the preloaded files in cache. This means that if you want to store it in say Redis, you will have to serialize the DTO yourself using a decorator around the Redis cache.

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2026 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

58

—

FairBetter than 98% of packages

Maintenance72

Regular maintenance activity

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 68.2% of commits — single point of failure

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 ~208 days

Recently: every ~449 days

Total

15

Last Release

156d ago

Major Versions

1.3.0 → 304.x-dev2018-09-12

1.5.0 → 2.0.02020-07-11

2.3.1 → 3.0.02025-12-13

PHP version history (6 changes)1.0.0PHP ^7.0

1.1.0PHP ^7.1

1.3.0PHP ^7.2

2.0.0PHP ^7.4

2.1.0PHP ^7.4 || ^8.0

3.0.0PHP ^8.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 (150 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (31 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (20 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (13 commits)")[![renovate-runner[bot]](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/renovate-runner[bot] "renovate-runner[bot] (3 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")[![blanky0230](https://avatars.githubusercontent.com/u/5700358?v=4)](https://github.com/blanky0230 "blanky0230 (1 commits)")[![uzulla](https://avatars.githubusercontent.com/u/870716?v=4)](https://github.com/uzulla "uzulla (1 commits)")

---

Tags

hacktoberfestphpreactphp

### Embed Badge

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

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[discord-php/http

Handles HTTP requests to Discord servers

25318.7k8](/packages/discord-php-http)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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