# hyva-themes/magento2-base-layout-reset

> Hyva Themes Magento base layout reset generation

`composer require hyva-themes/magento2-base-layout-reset`

Canonical URL: https://packagento.com/hyva-themes/magento2-base-layout-reset

## At a glance

- **Vendor**: hyva-themes (https://packagento.com/hyva-themes.md)
- **Latest version**: 2.0.5 — released 2026-06-08
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/hyva-themes/magento2-base-layout-reset and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require hyva-themes/magento2-base-layout-reset:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Hyva Themes Magento base layout reset generation

## README

[![Hyvä Themes](https://hyva.io/media/wysiwyg/logo-compact.png)](https://hyva.io/)

### hyva-themes/magento2-base-layout-reset

Generates a version of the base layout XML of core Magento modules and bundled extensions without block declarations.

This generated base layout is used instead of the original base layout for Hyvä based themes.

Its purpose is to avoid loading the original base layout, only to reset it with the reset theme. This improves performance on page requests that hit a cold layout cache.

### Installation

```sh
composer require hyva-themes/magento2-base-layout-reset
bin/magento module:enable Hyva_BaseLayoutReset
bin/magento setup:upgrade
```

If your custom theme inherits from `Hyva/default` or `Hyva/default-csp`, no additional steps are required.

### Usage

In Hyvä default-theme versions up to 1.3.18, a parent theme was used to override and remove block layout declarations from module folders.

Starting with version 1.4.0, Hyvä Themes use this module instead, which dynamically generates base layout declarations in `var/hyva-layout-resets/`.

This approach improves:

* Performance, on page requests with a cold layout cache.
* Maintainability, by removing the need for a reset theme.

The base layout resets are generated on the fly.  
It is also possible to trigger generation by running the command 

```sh
bin/magento hyva:base-layout-resets:generate
```

### Configuring the generation folder

You can define a custom absolute path for the generated layout files in `app/etc/env.php` using the `hyva_layout_resets_generation_directory` key.

**Example**
```php
return [
    'hyva_layout_resets_generation_directory' => '/var/www/html/generated/code/hyva-layout-resets/',
    ...
```

### What determines if a theme is a Hyvä Theme

A theme is considered a Hyvä-based theme if its inheritance chain contains a theme with a name starting with `Hyva/`.  
This was always true when using the `Hyva/reset` theme. However, when using the generated base layouts instead, this detection no longer works.

To ensure proper detection, base Hyvä themes must be added to the constructor argument `$hyvaBaseThemes` of `Hyva\BaseLayoutReset\Service\HyvaThemes` via `di.xml`.

In most projects, this is best done within a custom module, but it can also be defined in `app/etc/di.xml`.

### Custom Hyvä base themes

If you maintain a custom Hyvä base theme that directly extends `Hyva/reset`, you can migrate it to use the generated base layout reset.

**NOTE**: *This migration is optional - existing themes can continue using the reset theme without issues.*  

**Migration Steps**

* Add `<update handle="default_hyva"/>` to `Magento_Theme/layout/default.xml`.
* Copy `Magento_Theme/templates/root.phtml` from the reset theme into the Hyvä theme.
* Remove `<parent>Hyva/reset</parent>` from `theme.xml`.
* Update the `theme` table in the database, setting the `parent_id` of your theme to `NULL`.
* Add your theme code to the `hyvaBaseThemes` array in the constructor argument for `Hyva\BaseLayoutReset\Service\HyvaThemes` within `di.xml`.
* Clear the cache.

This module provides commands to help with these steps.

#### List Hyvä Theme reset information

To list all Hyvä themes and see their migration status, run:

```sh
bin/magento hyva:base-layout-resets:info
```

#### Migrating a custom Hyvä base theme to the generated layout reset

To automatically migrate a Hyvä base theme to the generated layout reset, run: 

```sh
bin/magento hyva:base-layout-resets:migrate Vendor/theme
```

Replace `Vendor/theme` with your theme code.  


**NOTE**: This command will update `app/etc/di.xml`, adding your theme to the `hyvaBaseThemes` argument of
`Hyva\BaseLayoutReset\Service\HyvaThemes`.
If you prefer not to modify `app/etc/di.xml`, you can move this declaration into a `di.xml` file inside your custom module.

*Be aware that many projects do not keep `app/etc/di.xml` in version control, and any changes may be lost. We recommend adding the declaration to a custom module `di.xml` instead.*


### License

This package is licensed under the **Open Software License (OSL 3.0)**.

* **Copyright:** Copyright © 2020-present Hyvä Themes. All rights reserved.
* **License Text:** The full text of the OSL 3.0 license can be found in the `LICENSE.txt` file within this package, and is also available online at [http://opensource.org/licenses/osl-3.0.php](http://opensource.org/licenses/osl-3.0.php).

[ico-compatibility]: https://img.shields.io/badge/magento-%202.4-brightgreen.svg?logo=magento&longCache=true&style=flat-square

## Recent Versions

| Version | Released |
|---|---|
| 2.0.5 | 2026-06-08 |
| 2.0.4 | 2026-04-09 |
| 2.0.3 | 2026-01-06 |
| 2.0.2 | 2025-11-24 |
| 2.0.1 | 2025-11-09 |
| 2.0.0 | 2025-11-03 |
| 1.0.0 | 2025-10-17 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| ext-dom | * |
| ext-libxml | * |
| ext-simplexml | * |
| hyva-themes/magento2-theme-module | >1.3.17 |
| magento/framework | * |
| magento/module-theme | >=1.0.2 |
| php | >=7.4.0 |
| psr/log | ^1 \|\| ^2 \|\| ^3 |

## Quality

Latest release (2.0.5) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| 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. Never affect the Compatibility verdict — 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.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 22 | 22 warnings (ruleset: Magento2) |
| PHPMD | Warning | 11 | 11 rule violations (MissingImport:6, UnusedFormalParameter:3, UnusedPrivateMethod:2) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 3 | valid; 3 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 102 | 102 | – | – |
| 2.4.8 | – | 102 | 102 | – |
| 2.4.9 | – | – | 98 | 98 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| 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

| 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 |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | N/A | 0 | no resolvable dependency tree to audit: Your requirements could not be resolved to an installable set of packages. Problem 1 |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["hyva-themes/magento2-base-layout-reset"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

hyva-themes is a Magento 2 vendor on Packagento. See https://packagento.com/hyva-themes.md for their full catalogue.

