yireo / magento2-dump-cms-content

yireo/magento2-dump-cms-content

N/A

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

Yireo DumpCmsContent

Magento version
PHP version
License
Latest Version

A Magento 2 module that adds a CLI bin/magento cms:dump to dump all CMS pages and CMS blocks to a folder var/cms-output.

Why?

This module was developed with Hyva Themes in mind: With a theme based on Hyva, your Tailwind CSS will need to be purged before going into production. For this, you would configure the Tailwind configuration to look into certain content folders to make sure CSS utility classes that are actually used, are not purged from the production CSS. Unfortunately, this does not work with the database.

Once you add Tailwind CSS classes to your CMS Blocks and CMS Pages (via the Magento Admin Panel, for instance by using some Tailwind-oriented WYSIWYG editor, or by inserting code manually), these CSS classes might or might not be purged, which could lead to incorrect CSS styling. To prevent this from happening, this module allows you to dump CMS contents to a folder var/cms-output, which could then be included in the Tailwind configuration:

module.exports = {
    ...
    purge: {
        content: [
            ...
            '../../../../../../../var/cms-output/**/*.html'
        ]
    }
}

Usage

bin/magento cms:dump
bin/magento cms:dump --include-inactive

By default, only active CMS blocks and CMS pages are dumped. Use --include-inactive to also dump disabled content.

Every file is named cms-block-{id}-{identifier}.html or cms-page-{id}-{identifier}.html. All characters of the identifier except a-z, 0-9, _ and - are replaced with _, so all files end up directly in var/cms-output. Entries without content are skipped.

Security notes

  • The folder var/cms-output is emptied on every run. Do not store anything else in it.
  • The command refuses to write when var/cms-output is a symlink pointing elsewhere.
  • The dump contains raw CMS content. Do not commit var/cms-output to a repository and make sure it is not publicly accessible via the webserver.

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

  • New --include-inactive option for cms:dump to also dump disabled CMS pages and blocks
  • cms:dump now reports how many files were written
  • README documents the cms:dump options and security notes
  • PHP 8.5 support

Changed

  • cms:dump now only dumps active CMS pages and blocks by default
  • Dump file names now combine the entity ID with a sanitized identifier (e.g. cms-page-12-about-us.html)
  • CMS content is loaded in batches of 100 to keep memory usage low on large stores

Removed

  • PHP 8.1 support (now PHP 8.2 - 8.5)

Fixed

  • CMS identifiers containing path segments (like ../) could write files outside var/cms-output (path traversal)
  • The dump is refused when var/cms-output is a symlink
  • Stale files from previous dumps are removed and CMS items without content are skipped
  • Missing composer dependencies (magento/module-cms, ext-pcre, symfony/console) are added and magento/framework is restricted to ^103.0

[1.0.0] - 09 October 2025

Fixed

  • Copy generic CI/CD files
  • Fix PHP 8.4 issue in Symfony Command
  • Add success return code
  • New license
  • Update composer.json
Versions
Version Stability QA Status Compatibility Released
1.1.0 stable Pass Magento 2.4.7-2.4.9 Details 2026-11-25 19:13:09
1.0.0 stable Fail Not yet tested Details 2025-10-09 06:41:37

Requires 5

Package Constraint
ext-pcre *
magento/framework ^103.0
magento/module-cms ^104.0
php >=8.2 <8.6
symfony/console ^5.0 | ^6.0 | ^7.0

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 Pass 0
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 Error Error
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.