PHPackages                             mage-os/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. mage-os/module-worker-mode-hyva

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

mage-os/module-worker-mode-hyva
===============================

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

1.0.1(yesterday)00OSL-3.0PHPPHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

Since Jun 13Pushed yesterdayCompare

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

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

MageOS\_WorkerModeHyva
======================

[](#mageos_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`mage-os/module-worker-mode`^1.0`hyva-themes/magento2-theme-module`\*Installation
------------

[](#installation)

```
composer require mage-os/module-worker-mode-hyva
bin/magento module:enable MageOS_WorkerModeHyva
bin/magento setup:upgrade
```

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

[](#how-it-works)

`etc/di.xml` registers a preference that replaces `Hyva\Theme\ViewModel\HyvaCsp` with `MageOS\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

42

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~5 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100189073?v=4)[Mage-OS](/maintainers/mage-os-ci)[@mage-os-ci](https://github.com/mage-os-ci)

---

Top Contributors

[![Sental](https://avatars.githubusercontent.com/u/35261502?v=4)](https://github.com/Sental "Sental (4 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/mage-os-module-worker-mode-hyva/health.svg)](https://phpackages.com/packages/mage-os-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)
