VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/11.1-development-environment-setup

⇱ Development Environment Setup | MahoCommerce/maho | DeepWiki


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

Development Environment Setup

This document provides comprehensive instructions for setting up a local development environment for Maho. It covers system requirements, dependency installation, database configuration, development tooling, and common workflows.


System Requirements

PHP Version and Extensions

Maho requires PHP 8.3 or higher. The codebase is actively developed and tested against PHP 8.3, 8.4, and 8.5 composer.json15

Required PHP Extensions: The following extensions must be enabled in your php.ini composer.json16-38:

  • ctype, curl, dom, fileinfo, filter, ftp, gd, hash, iconv, intl, json, libxml, mbstring, openssl, pdo, pdo_mysql, session, simplexml, soap, sodium, spl, zip, zlib.

Optional Extensions:

Database Engines

Maho supports multiple database engines through Doctrine DBAL 4.4 composer.json43

EngineVersionProduction UseNotes
MySQL5.7+✅ RecommendedMost battle-tested option
MariaDB10.3+✅ RecommendedDrop-in MySQL replacement
PostgreSQL12+✅ SupportedModern SQL features
SQLite3.8+⚠️ Development onlySingle-file database

Composer

Composer 2.x is required for dependency management. The project uses a custom composer plugin mahocommerce/maho-composer-plugin to handle module installations composer.json50

Sources: composer.json15-68 composer.json94-103


Development Environment Architecture


Sources: composer.json110-120 lib/Maho.php19-46


Initial Setup

1. Clone and Install Dependencies


This installs core dependencies including:

2. File Permissions

The following directories must be writable by the web server and CLI user:

3. Autoloader and Path Resolution

Maho uses a modernized autoloader structure. PSR-4 namespaces are defined for core libraries composer.json110-115 The Maho utility class provides helper methods to interact with the Composer environment:

  • Maho::getInstalledPackages(): Returns an array of installed packages via Maho\ComposerPlugin\AutoloadRuntime lib/Maho.php32-35
  • Maho::getBasePath(): Resolves the root install path lib/Maho.php40-46
  • Maho::getComposerAutoloader(): Returns the Composer\Autoload\ClassLoader instance lib/Maho.php163-169
  • Maho::recompilePhpAttributes(): Manually triggers the compilation of PHP attributes (observers, routes) via the Composer plugin runtime lib/Maho.php69-102

4. IDE Support

Maho provides deep IDE integration via the mahocommerce/maho-phpstan-plugin composer.json85 The system includes a baseline configuration to manage existing static analysis issues during development .phpstan.dist.baseline.neon1-25

Sources: composer.json35-93 composer.json110-115 lib/Maho.php19-169


Installation Methods

CLI Installation

The maho script provides a robust installation command. For full details on the installation command, see CLI Architecture (10.1) and Installation Command (10.2).

Database Setup

Maho supports multi-database configurations. The database connection details are stored in app/etc/local.xml after installation.

The CLI tool includes specific commands for interacting with the configured database:

Database Query Execution Flow (CLI):


Sources: lib/MahoCLI/Commands/DBQuery.php41-56 lib/MahoCLI/Commands/DBQuery.php58-111 lib/MahoCLI/Commands/DBConnect.php38-43


Development Tools Configuration

Code Style (PHP-CS-Fixer)

Maho enforces strict coding standards.

  • Ruleset: Uses @PER-CS2.0 with additional project-specific rules composer.json84
  • Modernization: Rector is included to automate PHP 8.3+ migrations composer.json89

Static Analysis (PHPStan)

PHPStan is used to find bugs and type mismatches.

  • Plugin: Uses mahocommerce/maho-phpstan-plugin for deep integration with Maho's magic methods and factory patterns composer.json85
  • Baseline: A comprehensive baseline is maintained in .phpstan.dist.baseline.neon to allow incremental improvements while keeping the build green .phpstan.dist.baseline.neon1-100

Testing (Pest)

Maho uses the Pest testing framework composer.json90 Tests are located in the tests/ directory and use a dedicated runner script tests/pest-with-test-db.php composer.json122-124

Running Tests:


Sources: composer.json122-125 composer.json84-93


Modern Development Patterns

Localization and Formatting

The Mage_Core_Model_Locale class handles unit constants and formatting for development app/code/core/Mage/Core/Model/Locale.php13-65

Configuration and System Settings

System configuration is defined via system.xml files. The core settings include advanced cache controls and rate limiting app/code/core/Mage/Core/etc/system.xml29-77

Performance Tooling

Maho includes a built-in minification helper Mage_Core_Helper_Minify for frontend assets app/code/core/Mage/Core/Helper/Minify.php17

Minification Data Flow:


Sources: app/code/core/Mage/Page/Block/Html/Head.php110-121 app/code/core/Mage/Core/Helper/Minify.php47-100 app/code/core/Mage/Core/Helper/Minify.php134-189 app/code/core/Mage/Core/Model/Locale.php13-65 app/code/core/Mage/Core/etc/system.xml13-150