yireo / magento2-html-hints
N/A
Yireo HtmlHints
A simple Magento 2 module that - once enabled - adds HTML hints to the frontend
This module adds HTML hints (HTML comments <!-- -->) to the HTML output of a page, adding details on the rendered block or container.
Installation
composer require yireo/magento2-html-hints
bin/magento module:enable Yireo_HtmlHints
Configuration
HTML hints are disabled by default. Enable them via Stores > Configuration > Advanced > Developer > HTML Hints > Enabled. Note that the Developer section is only visible in the Admin Panel when Magento runs in developer mode. Alternatively, use the CLI:
bin/magento config:set dev/html_hints/enabled 1
Changing this setting in the Admin Panel requires the Magento_Config::dev admin permission (Stores > Configuration > Developer section).
Notes:
- Hints are only added when Magento is running in developer mode, even when the setting is enabled.
- Hints are only added while a storefront page result is rendered. They are skipped for AJAX requests, for layouts other than the main page layout and for emails.
- While hints are active, the full page cache and the block HTML cache are disabled, so hinted output is never stored in or served from these caches. After disabling hints, flush the caches with
bin/magento cache:flush.
Usage
Before:
<div class="page-title-wrapper">
<h1 class="page-title" id="page-title-heading" aria-labelledby="page-title-heading toolbar-amount">
<span class="base" data-ui-id="page-title-wrapper">Example</span>
</h1>
</div>
After:
<!-- BLOCK CLASS: Magento\Theme\Block\Html\Title\Interceptor / BLOCK NAME: page.main.title / TEMPLATE NAME: Magento_Theme::html/title.phtml / TEMPLATE FILE: /var/www/html/vendor/magento/module-theme/view/frontend/templates/html/title.phtml -->
<div class="page-title-wrapper">
<h1 class="page-title" id="page-title-heading" aria-labelledby="page-title-heading toolbar-amount">
<span class="base" data-ui-id="page-title-wrapper">Example</span>
</h1>
</div>
<!-- END BLOCK page.main.title -->
Current status
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
- Admin setting (Stores > Configuration > Advanced > Developer > HTML Hints) to switch hints on; it is off by default and still only works in developer mode
- Block hints now show the render time in microseconds
- PHP 8.5 support
Changed
- Container hints are added through a plugin instead of a LayoutInterface preference, avoiding conflicts with other modules that override the layout
Removed
- PHP 8.1 support
Fixed
- Block names, class names and template paths are sanitized so they cannot break out of the HTML comment
- Hints are no longer injected into AJAX responses, non-page layouts or transactional emails
- Full page cache and block HTML cache are bypassed while hints are active, so hinted output is never cached
[1.0.0] - 06 January 2026
Initial release
- Add rendering time to block hints
- Also add observer to add hints to much more blocks
- Only enable in Developer Mode
- Initial concept
Requires 7
| Package | Constraint |
|---|---|
| ext-pcre | * |
| magento/framework | ^101.0 | ^102.0 | ^103.0 |
| magento/module-backend | ^101.0 | ^102.0 |
| magento/module-config | ^101.0 | ^102.0 |
| magento/module-page-cache | ^100.4 |
| magento/module-store | ^101.0 |
| php | >=8.2 <8.6 |
Requires-dev 2
| Package | Constraint |
|---|---|
| phpunit/phpunit | ^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.
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.
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.
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
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.
More from yireo
View vendorReplace bundled third party packages from Magento
N/A
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.