• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valkyrjaio / valkyrja-php / 27858155867
100%

Build:
DEFAULT BRANCH: 26.x
Ran 20 Jun 2026 03:01AM UTC
Jobs 1
Files 1135
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Jun 2026 02:59AM UTC coverage: 100.0%. Remained the same
27858155867

push

github

web-flow
[Http] Replace response-cache file generation with JSON serialization (#868)

# Description

Reworks the HTTP response cache to be language-agnostic and removes the
PHP file-generation machinery behind it.

Previously `CacheResponseMiddleware` cached a response by generating a
PHP file (via `ResponseFileGenerator` → `var_export`) and reloading it
with `require`. That approach is PHP-specific and executes a generated
file on every cache hit. It now serializes the response to JSON on
`terminated()` — class, status code, reason phrase, headers, body (plus
the URI for redirects) — and reconstructs the response from that JSON on
`requestReceived()`. Reconstruction mirrors the generic build the
generator used to emit as code: instantiate the response with only its
`headers` argument (the one constructor parameter shared by every
response subclass, all of which extend `Response`) and apply the status
code, reason phrase, and body via the immutable `with*` methods.

External cache behavior is unchanged — the existing
`CacheResponseMiddlewareTest` round-trips every response type
(`Response`, `Empty`, `Html`, `Json`, `Redirect`) through the cache and
passes unmodified. With the cache no longer depending on it, the
file-generation infrastructure is removed entirely.

---

## Types of Changes

- [ ] Improvement _(non-breaking change which improves code)_
- [ ] Bug fix _(non-breaking change which fixes an issue)_
- [ ] New feature _(non-breaking change which adds functionality)_
- [ ] Deprecation _(breaking change which removes functionality)_
- [x] Breaking change _(fix or feature that would cause existing
functionality to change)_
- [ ] Documentation improvement

---

## Changes

- **`src/Valkyrja/Http/Server/Middleware/CacheResponseMiddleware.php`**
— cache now serializes/deserializes responses as JSON
(`serializeResponse`, `loadCachedResponse`, `deserializeResponse`)
instead of generating and `require`-ing a PHP file; TTL/expiry/validity
helpers are unchanged
... (continued)

60 of 60 new or added lines in 1 file covered. (100.0%)

12427 of 12427 relevant lines covered (100.0%)

16.01 hits per line

Jobs
ID Job ID Ran Files Coverage
1 27858155867.1 20 Jun 2026 03:01AM UTC 1135
100.0
GitHub Action Run
Source Files on build 27858155867
  • Tree
  • List 1135
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #27858155867
  • 703d41c1 on github
  • Prev Build on 26.x (#27855990138)
  • Next Build on 26.x (#27885209191)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc