PHPackages                             wyrihaximus/react-http-middleware-response-cache-session-cache-configuration - 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. [Caching](/categories/caching)
4. /
5. wyrihaximus/react-http-middleware-response-cache-session-cache-configuration

ActiveLibrary[Caching](/categories/caching)

wyrihaximus/react-http-middleware-response-cache-session-cache-configuration
============================================================================

Cache configuration that will prevent any request or response with an active session interact with the cache

2.0.0(7y ago)01.0k[2 PRs](https://github.com/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration/pulls)MITPHPPHP ^7.2CI failing

Since Apr 10Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration)[ Packagist](https://packagist.org/packages/wyrihaximus/react-http-middleware-response-cache-session-cache-configuration)[ RSS](/packages/wyrihaximus-react-http-middleware-response-cache-session-cache-configuration/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (5)Used By (0)

Session aware cache configuration for [`wyrihaximus/react-http-middleware-response-cache`](https://github.com/WyriHaximus/reactphp-http-middleware-response-cache)
==================================================================================================================================================================

[](#session-aware-cache-configuration-for-wyrihaximusreact-http-middleware-response-cache)

[![Build Status](https://camo.githubusercontent.com/6a648c90769f46d00598205252ac334702cff80e014aca7b78ee978827cf0773/68747470733a2f2f7472617669732d63692e6f72672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration)[![Latest Stable Version](https://camo.githubusercontent.com/6fa3e8979b78bad6a4f334ad6620ff8cec781dc17a27b69b405d7007ef25d635/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache-session-cache-configuration)[![Total Downloads](https://camo.githubusercontent.com/d44c900b33116e62ac9f92a721f75704d6616ae344ec43da58202e4762fa056e/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache-session-cache-configuration)[![Code Coverage](https://camo.githubusercontent.com/4531714695fbc2206446c248300d02d8e56d9bdc5e47823f8dd39c76015be5fa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration/?branch=master)[![License](https://camo.githubusercontent.com/d80aed1da4999f2c98f02c8f9c6478b7a16909722c90241162a7e63263e2ceca/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2f6c6963656e73652e706e67)](https://packagist.org/packages/WyriHaximus/react-http-middleware-response-cache-session-cache-configuration)[![PHP 7 ready](https://camo.githubusercontent.com/4b84fc99312a420990d3aa9eeb5dd35325dd59273751fd2f49c659e1835bfc6f/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f72656163747068702d687474702d6d6964646c65776172652d726573706f6e73652d63616368652d73657373696f6e2d63616368652d636f6e66696775726174696f6e2f62616467652e737667)](https://travis-ci.org/WyriHaximus/reactphp-http-middleware-response-cache-session-cache-configuration)

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-response-cache-session-cache-configuration

```

Cache configuration decorator for [`wyrihaximus/react-http-middleware-response-cache`](https://github.com/WyriHaximus/reactphp-http-middleware-response-cache)and [`wyrihaximus/react-http-middleware-session`](https://github.com/WyriHaximus/reactphp-http-middleware-session). When a request is going through that has an active session the cache is skipped and the request is passed to the next middleware in the chain. When a response is going through that has an active session the response won't be stored in the cache. The order of middleware is critical for the correct working of this cache configuration decorator. The example below shows the correct order.

Usage
=====

[](#usage)

```
$server = new Server([
    /** Other middleware */
    new SessionMiddleware('Floki'), // Note that the order here is important. The session middleware MUST attach the session before the ResponseCacheMiddleware
    new ResponseCacheMiddleware(
        new SessionCacheConfiguration(
            new CacheConfiguration(
                [
                    '/',
                    '/robots.txt',
                    '/favicon.ico',
                    '/cache/***', // Anything that starts with /cache/ in the path will be cached
                    '/api/???', // Anything that starts with /cache/ in the path will be cached (query is included in the cache key)
                ],
                [ // Optional, array with headers to include in the cache
                    'Content-Type',
                ]
           )
        ),
        new ArrayCache() // Optional, will default to ArrayCache but any CacheInterface cache will work.
    ),
    /** 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

35

—

LowBetter than 79% of packages

Maintenance43

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

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

Total

2

Last Release

2805d ago

Major Versions

1.0.0 → 2.0.02018-09-03

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^7.2

### 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 (19 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")

---

Tags

cacheconfigurationhacktoberfesthttpmiddlewarereactphpsession

### Embed Badge

![Health badge](/badges/wyrihaximus-react-http-middleware-response-cache-session-cache-configuration/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-react-http-middleware-response-cache-session-cache-configuration/health.svg)](https://phpackages.com/packages/wyrihaximus-react-http-middleware-response-cache-session-cache-configuration)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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