yireo / magento2-theme-commands

yireo/magento2-theme-commands

CLI commands to manipulate themes

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

Yireo_ThemeCommands module

Magento version
PHP version
License
Latest Version

Magento 2 module to add CLI commands to manage themes from the command-line

Installation

composer require yireo/magento2-theme-commands
bin/magento module:enable Yireo_ThemeCommands

Usage

List all themes:

bin/magento theme:list

List all assigned themes (aka design configurations):

bin/magento theme:design_config

The theme:design_config output also shows an Override column, which identifies whether a specific value (like, a theme ID for a specific Store View) is indeed overriding the default or not.

Change the current theme to Magento/luma for all scopes:

bin/magento theme:change Magento/luma

Note that the theme:change command also includes a flag --reset (valid only for the default scope) which removes the theme setting of all websites and store views, so that only 1 theme is active. You are asked for confirmation, unless you add --no-interaction:

bin/magento theme:change --reset Magento/luma
bin/magento theme:change --reset --no-interaction Vendor/theme

Change the current theme to Hyva/default for the StoreView with ID 1:

bin/magento theme:change Hyva/default stores 1

Create a new theme:

bin/magento theme:create --theme Yireo/example --parent Magento/luma --application frontend
bin/magento theme:change Yireo/example

The theme name needs to be formatted like Vendor/theme_name (a vendor name starting with an uppercase letter, a theme name in lowercase letters, digits, - and _). The --application can only be frontend (default) or adminhtml. The parent theme needs to exist already. Existing theme files are not overwritten, unless you add --force.

Caveats

When a new theme has been created, it might have not been discovered by Magento. For instance, the output of the theme:list command is not showing this new theme. Run bin/magento setup:upgrade first.

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.4.0] - 26 November 2026

Added

  • theme:list shows whether a theme is active in a store, plus its type and parent ID
  • theme:list option --json to output the list as JSON
  • theme:list option --type to filter on Hyvä or Luma themes
  • Support for PHP 8.5

Changed

  • BREAKING: theme:create only accepts theme names like Vendor/theme_name, --application must be frontend or adminhtml and the parent theme must exist
  • BREAKING: theme:create no longer overwrites existing theme files unless --force is given
  • BREAKING: theme:change --reset is now a flag without value, only works for the default scope, asks for confirmation and runs in a transaction
  • theme:change only assigns frontend themes and rejects scope IDs of websites or store views that do not exist

Removed

  • Support for PHP 8.1

Fixed

  • Shell command injection and path traversal in theme:create via the theme name, --application or the custom skeleton folder
  • Console output could be spoofed or hidden by formatter tags and terminal escape sequences in values from the database, theme.xml files or input
  • theme:list looping endlessly on themes with cyclic parent themes
  • Scope websites always rejected by theme:change
  • Name and ID printed in swapped columns by theme:design_config
  • Raw SQL with unescaped scope values in theme:change and theme:design_config
  • Missing module dependencies on Magento_Indexer, Magento_Store and Magento_Theme
  • PHP 8.6 deprecation of trim() without explicit characters

[1.3.4] - 22 October 2025

Fixed

  • Wrong imported namespace of Composer, should be Symfony Console

[1.3.3] - 08 October 2025

Fixed

  • Add new command "theme:path" to return full path for given theme

[1.3.2] - 23 April 2025

Fixed

  • Fix PHP 8.4 deprecation

[1.3.1] - 10 March 2025

Fix

  • Wrong regex when creating theme

[1.3.0] - 1 July 2024

Added

  • Add --reset flag to theme:change command
  • Add new command theme:design_config

[1.2.1] - 6 February 2024

Fixed

  • namespace correction for InputOption #3 @meminuygur

[1.2.0] - 3 February 2024

Added

  • New command to create a new theme

[1.1.0] - 5 November 2023

Added

  • New command to list all themes

Fixed

  • Cleanup deps in change command

[1.0.3] - 30 August 2023

Fixed

  • Fix issue with grid not being updated for global scope

[1.0.2] - 20 June 2023

Fixed

  • Fix scope_id validation when using default scope #2 @lbanka

[1.0.1] - 17 June 2023

Added

  • Allow to use scope codes #1 @lbanka

[1.0.0] - 16 June 2023

  • Initial release
Versions
Version Stability QA Status Compatibility Released
1.4.0 stable Pass Magento 2.4.7-2.4.9 Details 2026-11-26 01:39:19
1.3.4 stable Fail Not yet tested Details 2025-10-22 11:15:39
1.3.3 stable Not tested Not yet tested Details 2025-10-08 14:41:17
1.3.2 stable Not tested Not yet tested Details 2025-04-23 11:33:52
1.3.1 stable Not tested Not yet tested Details 2025-03-10 07:59:19
1.3.0 stable Not tested Not yet tested Details 2024-07-01 14:43:14
1.2.1 stable Not tested Not yet tested Details 2024-02-06 13:19:08
1.2.0 stable Not tested Not yet tested Details 2024-02-03 09:03:15
1.1.0 stable Not tested Not yet tested Details 2023-11-05 15:22:40
1.0.3 stable Not tested Not yet tested Details 2023-08-30 12:13:28
1.0.2 stable Not tested Not yet tested Details 2023-06-21 06:28:31
1.0.1 stable Not tested Not yet tested Details 2023-06-17 05:09:20
1.0.0 stable Not tested Not yet tested Details 2023-06-16 12:41:07

Requires 7

Package Constraint
ext-json *
ext-pcre *
magento/framework ^103.0
magento/module-indexer ^100.4
magento/module-store ^101.1
magento/module-theme ^101.1
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.

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 34 34 warnings (ruleset: Magento2)
PHPMD Warning 7 7 rule violations (UnusedFormalParameter:3, NPathComplexity:2, TooManyPublicMethods:1, MissingImport:1)
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 Error Error
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.