yireo / magento2-clean-modules

yireo/magento2-clean-modules

Magento 2 module to remove invalid entries from app/etc/config.php

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

Yireo_CleanModules

Magento version
PHP version
License
Latest Version

This Magento 2 module adds a CLI command yireo:modules:clean to remove non-existing modules from app/etc/config.php

Installation

Install this package via composer:

composer require yireo/magento2-clean-modules

Next, enable this module:

bin/magento module:enable Yireo_CleanModules

Usage

bin/magento yireo:modules:check            # Lists enabled modules that do not exist (exit code 1 if any)
bin/magento yireo:modules:clean --dry-run  # Shows which modules would be disabled
bin/magento yireo:modules:clean            # Asks for confirmation, backs up app/etc/config.php and disables missing modules
bin/magento yireo:modules:clean --remove   # Removes missing modules (enabled or disabled) from app/etc/config.php instead of disabling them
bin/magento yireo:modules:clean --force    # Skips the confirmation and the safety check on core modules or more than 10 modules

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]

[0.0.4] - 26 November 2026

Added

  • Add --remove option to delete missing modules from config.php

Added

  • yireo:modules:clean has a --remove option to delete missing modules from app/etc/config.php instead of disabling them

[0.0.3] - 25 November 2026

Added

  • yireo:modules:clean has a --dry-run option to preview which modules would be disabled, and a --force option to skip the confirmation and safety checks

Changed

  • yireo:modules:clean now asks for confirmation, refuses to disable Magento_ core modules or more than 10 modules at once without --force, and writes a backup of app/etc/config.php before changing it
  • yireo:modules:check now exits with a failure code when modules are missing

Removed

  • Support for PHP 8.1 and Magento framework versions older than 103.0.6 (now requires PHP 8.2 to 8.5)

Fixed

  • Storefront CSP violation reports, including full page URLs with password reset tokens, were sent to a third-party uriports.com endpoint
  • Google, Google Tag Manager and PayPal hosts were globally allowed in the storefront CSP policy
  • app/etc/config.php could get corrupted, because it was read with include and rewritten by string replacement instead of through Magento's deployment config
  • Missing modules are now detected via the component registrar and module names are escaped in console output

[0.0.1] - 10 April 2025

Fixed

  • Initial release
Versions
Version Stability QA Status Compatibility Released
0.0.4 stable Pass Magento 2.4.7-2.4.9 Details 2026-11-26 14:44:05
0.0.3 stable Pass Magento 2.4.7-2.4.9 Details 2026-11-25 19:03:38
0.0.2 stable Pass Not yet tested Details 2025-07-24 09:17:27
0.0.1 stable Not tested Not yet tested Details 2025-04-10 09:19:00

Requires 2

Package Constraint
magento/framework ^103.0.6|^104.0
php >=8.2 <8.6

Requires-dev 1

Package Constraint
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 8 8 warnings (ruleset: Magento2), 6 auto-fixable with phpcbf
PHPMD Warning 4 4 rule violations (UnusedFormalParameter:1, CyclomaticComplexity:1, NPathComplexity:1, TooManyPublicMethods: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 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 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.