yireo / magento2-hyva-theme-auto-registration

yireo/magento2-hyva-theme-auto-registration

Automatically include modules in the Hyvä Theme registration

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Warning Tests: Pass Security: Pass OSL-3.0

Yireo HyvaThemeAutoRegistration

Magento version
PHP version
License
Latest Version

Magento 2 module to make it easier to register a custom tailwind.config.js file of your own module in the global Hyvä Themes Tailwind configuration

Background

Hyvä Themes offers a Magento 2 CLI command hyva:config:generate to allow building a file app/etc/hyva-themes.json that again is used in modern-day Tailwind configuration of Hyvä-based themes. However, to extend this, one must add a custom observer to the module, which leads to a lot of code duplication across your modules. This module aims to simplify this. It offers an observer following the official Hyvä documentation.

However, this observer automatically registers any module that has a prefix Yireo_ or YireoTraining_ (it works for me). And it allows for extending things with a DI plugin.

Usage

Add this module as a dependency to your composer.json file and etc/module.xml file.

Next, add the following DI configuration to your module its etc/di.xml file (assuming here that Foo_Bar is the name of your own module):

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Yireo\HyvaThemeAutoRegistration\Observer\RegisterModuleForHyvaConfig">
        <arguments>
            <argument name="moduleNames" xsi:type="array">
                <item name="Foo_Bar" xsi:type="string">Foo_Bar</item>
            </argument>
        </arguments>
    </type>
</config>

Alternatively, you can include all your modules by configuring a module prefix:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Yireo\HyvaThemeAutoRegistration\Observer\RegisterModuleForHyvaConfig">
        <arguments>
            <argument name="modulePrefixes" xsi:type="array">
                <item name="Foo_" xsi:type="string">Foo_</item>
            </argument>
        </arguments>
    </type>
</config>

A module prefix only matches the start of a module name: Foo_ matches Foo_Bar, but not AcmeFoo_Bar. Empty prefixes are ignored.

Default prefixes and excluding modules

By default, this module registers the prefixes Yireo_ and YireoTraining_. Every matching module with a file view/{base,frontend}/tailwind/tailwind.config.js or tailwind-source.css is added to app/etc/hyva-themes.json. Note that the tailwind.config.js of every included module is executed by Node during the Hyvä theme build, so only include modules that you trust.

To exclude specific modules, use the skipModules argument:

<type name="Yireo\HyvaThemeAutoRegistration\Observer\RegisterModuleForHyvaConfig">
    <arguments>
        <argument name="skipModules" xsi:type="array">
            <item name="Yireo_Example" xsi:type="string">Yireo_Example</item>
        </argument>
    </arguments>
</type>

To disable a default prefix, override its item with an empty value:

<type name="Yireo\HyvaThemeAutoRegistration\Observer\RegisterModuleForHyvaConfig">
    <arguments>
        <argument name="modulePrefixes" xsi:type="array">
            <item name="YireoTraining_" xsi:type="string"></item>
        </argument>
    </arguments>
</type>

Current status

Static Tests
Unit Tests
Integration Tests
Playwright
DI Compilation

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[Unreleased]

[1.1.0] - 25 November 2026

Added

  • Support for PHP 8.5
  • Documentation of the default prefixes (Yireo_, YireoTraining_), prefix matching and how to exclude modules or disable a default prefix

Removed

  • Support for PHP 8.1 (PHP 8.2 to 8.5 is now required)

Fixed

  • Security: module prefixes now only match at the start of a module name, so modules like AcmeYireo_Foo or an empty prefix no longer pull arbitrary modules (and their tailwind.config.js) into the Hyvä build
  • Modules that are listed but not registered are skipped instead of producing broken entries in app/etc/hyva-themes.json
  • Module paths are made relative to the Magento root only when they start with it
  • Malformed event config data or extension entries no longer cause errors

[1.0.7] - 22 October 2025

Fixed

  • Copy generic CI/CD files
  • Add support for base-folder
  • Add PHP 8.4

[1.0.6]

  • Initial releases
Versions
Version Stability QA Status Compatibility Released
1.1.0 stable Pass Magento 2.4.7-2.4.9 Details 2026-11-25 17:32:04
1.0.7 stable Fail Not yet tested Details 2025-10-22 11:26:43
1.0.6 stable Not tested Not yet tested Details 2025-02-13 18:59:02
1.0.5 stable Not tested Not yet tested Details 2024-12-01 18:45:33
1.0.4 stable Not tested Not yet tested Details 2024-11-18 13:45:06
1.0.3 stable Not tested Not yet tested Details 2024-10-08 08:49:39
1.0.2 stable Not tested Not yet tested Details 2024-10-04 08:26:28
1.0.1 stable Not tested Not yet tested Details 2023-11-20 11:14:37
1.0.0 stable Not tested Not yet tested Details 2023-10-30 07:48:44

Requires 2

Package Constraint
magento/framework ^102.0|^103.0
php >=8.2 <8.6

Requires-dev 2

Package Constraint
phpunit/phpunit ^9.5 || ^10.5
yireo/magento2-integration-test-helper ~0.0

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 5 5 warnings (ruleset: Magento2), 3 auto-fixable with phpcbf
PHPMD Pass 0
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
OSL-3.0

More from yireo

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.