VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/11.6-dependency-management-and-modernization

⇱ Dependency Management and Modernization | MahoCommerce/maho | DeepWiki


Loading...
Last indexed: 15 May 2026 (ea8ab8)
Menu

Dependency Management and Modernization

Purpose and Scope

This page documents Maho's dependency management strategy using Composer and the ongoing modernization from the legacy architecture to a contemporary PHP 8.3+ platform. It covers external dependencies, library versions, the migration from legacy components to modern Symfony alternatives, and the management of installed packages via the Maho utility class.

Composer-Based Dependency Management

Maho uses Composer for all external dependency management. The platform requires PHP 8.3+ composer.json15 and strictly manages all third-party libraries through composer.json.

Composer Configuration Structure

Title: Composer Dependency Flow


Sources: composer.json1-137 composer.lock1-7

Package Structure

Maho defines several categories of dependencies to maintain a clean and modern environment:

CategoryPurposeKey Packages
requireRuntime dependencies for productionsymfony/* (v7.4), doctrine/dbal (v4.4), monolog/monolog (v3.9), intervention/image (v4.0), altcha-org/altcha composer.json39-66
require-devDevelopment and testing toolspestphp/pest (v4), phpstan/phpstan (v2), rector/rector (v2), psy/psysh composer.json82-91
replacePackages that Maho supersedesopenmage/magento-lts, magento-hackathon/magento-composer-installer, symfony/polyfill-php80 through php83 composer.json68-81
conflictIncompatible legacy packagescolinmollenhour/cache-backend-redis, colinmollenhour/magento-redis-session composer.json103-106
suggestOptional enhancementsext-pdo_pgsql, ext-pdo_sqlite, mahocommerce/module-braintree, picqer/php-barcode-generator composer.json93-102

Sources: composer.json14-106

Runtime Dependency Architecture

Modern Component Stack

Maho has replaced legacy internal logic with established industry-standard libraries.

Title: Core Runtime Dependencies and Code Entities


Sources: composer.json39-66 app/code/core/Mage/Core/Helper/Minify.php14-15 lib/Maho.php15-18

Required PHP Extensions

The platform target is strictly PHP 8.3 composer.json133 The following extensions are mandatory for core functionality:

ExtensionPurpose
ext-sodiumModern encryption and security composer.json35
ext-pdo_mysqlPrimary database driver composer.json31
ext-intlLocalization and internationalization composer.json25
ext-dom / ext-libxmlXML parsing for configuration and layout composer.json18-27
ext-gdLegacy image support (complemented by Intervention) composer.json22
ext-zipPackage and archive management composer.json37
ext-soapSOAP web services composer.json34

Sources: composer.json15-38

Modernization Strategy

The Maho Utility Class

The Maho class in lib/Maho.php serves as the bridge between the Composer-managed vendor directory and the legacy application structure.

  • Package Discovery: Maho::getInstalledPackages() retrieves the list of packages directly from the Composer runtime lib/Maho.php32-35
  • Path Resolution: Maho::findFile() and Maho::findClassFile() respect package overrides and the Composer autoloader lib/Maho.php134-211
  • Attribute Recompilation: Maho::recompilePhpAttributes() triggers the AttributeCompiler to process PHP 8 attributes for observers, cron jobs, and routes lib/Maho.php69-102
  • Autoloader Management: Maho::updateComposerAutoloader() allows for dynamic class map updates during development lib/Maho.php174-195
  • Maintenance Mode: Maho::maintenancePage() provides a modern fallback system for store-specific maintenance templates lib/Maho.php220-245

Sources: lib/Maho.php19-245

Removed and Replaced Components

Maho actively removes legacy libraries in favor of modern PSR-compliant alternatives. The HealthCheck command identifies several deprecated paths and files.

Removed ComponentReplacement / Status
lib/ZendReplaced by laminas/* or Symfony components lib/MahoCLI/Commands/HealthCheck.php41
lib/CredisRedis logic moved to modern backends lib/MahoCLI/Commands/HealthCheck.php37
lib/mcryptcompatReplaced by ext-sodium lib/MahoCLI/Commands/HealthCheck.php38
PrototypeJSLegacy frontend scripts are being phased out in favor of mahoFetch and vanilla JS app/locale/en_US/Mage_Core.csv5

Sources: lib/MahoCLI/Commands/HealthCheck.php34-43 app/locale/en_US/Mage_Core.csv5

CSS and JS Minification Modernization

Maho has replaced legacy minification logic with the MatthiasMullie\Minify library app/code/core/Mage/Core/Helper/Minify.php14-15 This is implemented in Mage_Core_Helper_Minify, which provides automated caching and file locking to prevent race conditions during minification app/code/core/Mage/Core/Helper/Minify.php134-189

Legacy Health Checks and Migration

The MahoCLI\Commands\HealthCheck command identifies legacy files and folders that are no longer needed or have been modernized. It specifically tracks:

Sources: lib/MahoCLI/Commands/HealthCheck.php22-106 app/bootstrap.php26-101

Code Quality and Static Analysis

Maho maintains high code standards through automated analysis:

Sources: .phpstan.dist.baseline.neon1-223 lib/Maho.php198-203

PHP 8.3+ Migration and Adoption

Maho utilizes modern PHP features to improve type safety and performance:

  1. Strict Types: New components use declare(strict_types=1) lib/MahoCLI/Commands/HealthCheck.php11 app/code/core/Mage/Core/Helper/Minify.php3
  2. Attributes: Use of PHP 8 attributes (e.g., #[AsCommand], #[Override]) is standard across the modernized CLI and core blocks lib/MahoCLI/Commands/HealthCheck.php22 app/code/core/Mage/Page/Block/Html/Head.php25
  3. Union Types: Methods like Maho::findFile() and Maho::findClassFile() use union types for clearer return signatures lib/Maho.php134-208
  4. Compiled Attributes: PHP 8 attributes for observers and cron jobs are compiled into an optimized PHP file in vendor/composer/maho_attributes.php for runtime performance lib/Maho.php51-58

Sources: lib/Maho.php51-208 lib/MahoCLI/Commands/HealthCheck.php11-22 app/code/core/Mage/Page/Block/Html/Head.php25