PHPackages                             reessolutions/module-worker-mode-hyva - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. reessolutions/module-worker-mode-hyva

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

reessolutions/module-worker-mode-hyva
=====================================

Hyvä-specific FrankenPHP worker-mode compatibility fixes for Reessolutions projects

1.0.0(today)00OSL-3.0PHPPHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

Since Jun 13Pushed todayCompare

[ Source](https://github.com/Sental/module-worker-mode-hyva)[ Packagist](https://packagist.org/packages/reessolutions/module-worker-mode-hyva)[ RSS](/packages/reessolutions-module-worker-mode-hyva/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Reessolutions\_WorkerModeHyva
=============================

[](#reessolutions_workermodehyva)

Fixes Hyvä CSP state leaking across requests when running Magento 2 under FrankenPHP worker mode.

The problem
-----------

[](#the-problem)

Hyvä's `HyvaCsp` ViewModel caches two values after its first call per request — the collected CSP fetch policies (`$memoizedPolicies`) and the current area code (`$memoizedAreaCode`). Under normal PHP-FPM, this is fine: the process resets on every request. Under FrankenPHP worker mode, the process is long-lived and `HyvaCsp` is a shared singleton, so those cached values persist into the next request.

This causes a subtle but severe bug: if any request runs under a strict CSP (e.g. the checkout page, which doesn't allow `unsafe-eval`), `$memoizedPolicies` is set without `unsafe-eval`. Every *subsequent* request then sees `isEvalAllowed() = false` and loads `alpine3-csp.min.js` (the CSP Alpine build) instead of the standard Alpine. The CSP Alpine build cannot evaluate string expressions, so **every Alpine component on every page throws an error** until the worker process is recycled.

The stale `$memoizedAreaCode` causes a second issue: `isAreaCodeSet()` short-circuits to the wrong area, suppressing nonce/hash handling on pages running under a different area.

The fix
-------

[](#the-fix)

This module subclasses `HyvaCsp` and implements `ResetAfterRequestInterface`. The `_resetState()` method nullifies both private parent properties via reflection at the end of each request, so the next request starts with a clean slate.

Requirements
------------

[](#requirements)

DependencyVersionPHP8.0 – 8.5`reessolutions/module-worker-mode`^1.0`hyva-themes/magento2-theme-module`\*Installation
------------

[](#installation)

```
composer require reessolutions/module-worker-mode-hyva
bin/magento module:enable Reessolutions_WorkerModeHyva
bin/magento setup:upgrade
```

How it works
------------

[](#how-it-works)

`etc/di.xml` registers a preference that replaces `Hyva\Theme\ViewModel\HyvaCsp` with `Reessolutions\WorkerModeHyva\ViewModel\HyvaCsp`. The subclass adds only one method:

```
public function _resetState(): void
{
    // nullifies $memoizedPolicies and $memoizedAreaCode on the parent via reflection
}
```

Magento's object manager calls `_resetState()` on every class that implements `ResetAfterRequestInterface` at the end of each worker-mode request.

License
-------

[](#license)

OSL-3.0 — see [LICENSE](LICENSE).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b40d801582a7a90f95abd6f16485c3fce8b83eb7efead8ba5371459a7f38138?d=identicon)[Sental](/maintainers/Sental)

### Embed Badge

![Health badge](/badges/reessolutions-module-worker-mode-hyva/health.svg)

```
[![Health](https://phpackages.com/badges/reessolutions-module-worker-mode-hyva/health.svg)](https://phpackages.com/packages/reessolutions-module-worker-mode-hyva)
```

###  Alternatives

[jajuma/awesomehyva

This Magento 2 extension allows using Font Awesome 5 icons with Hyvä Themes

1352.7k](/packages/jajuma-awesomehyva)[elgentos/vat-switcher

Vat switcher to let customer decide on how to show their prices

1512.0k](/packages/elgentos-vat-switcher)[elgentos/magento2-hyva-cro-semi-sticky-header

Changes the Hyvä header to a semi-sticky header (dissapears down and reappears up)

162.1k](/packages/elgentos-magento2-hyva-cro-semi-sticky-header)[basecom/magento2-speculation-rules-toolbox

Magento2 module to provide extensive functionality for speculation rules

171.1k](/packages/basecom-magento2-speculation-rules-toolbox)

PHPackages © 2026

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