Building modules for current Joomla releases (5 and 6) calls for a modern approach. Instead of starting with a legacy PHP file in the module root, the current architecture uses namespaces, traits, and dependency-injection containers.
Meet Joomla Module Generator Professional
Generate a complete module structure in seconds. The tool automates modules for Joomla 4, 5, and 6. Configure metadata, choose from more than 75 parameter types (including complex subforms), integrate the Web Asset Manager, and download an installation-ready ZIP file.
The modern module architecture
A modern module separates its services, dispatching, helper logic, language files, assets, and display templates:
mod_mymodule/
├── language/
├── media/
├── services/
│ └── provider.php
├── src/
│ ├── Dispatcher/
│ │ └── Dispatcher.php
│ └── Helper/
│ └── Helper.php
├── tmpl/
│ └── default.php
└── mod_mymodule.xmlKey components
1. Service provider: services/provider.php
The service provider replaces the old entry point. It implements ServiceProviderInterface and registers the Dispatcher and Helper factories in Joomla's dependency-injection container.
2. Dispatcher: src/Dispatcher
The Dispatcher extends AbstractModuleDispatcher. It calls the Helper, reads the configured XML parameters, and passes structured data to the template.
3. Helper: src/Helper
The Helper contains data-retrieval and business logic. Use Joomla's database services for queries, keeping SQL and data access out of default.php in line with MVC practices.
4. Web Asset Manager: tmpl/default.php
Instead of the legacy JHtml::stylesheet approach, the template uses Joomla's Web Asset Manager to load CSS and JavaScript registered through joomla.asset.json.
Advanced features
- Nested subforms: Build repeatable JSON-backed structures for sliders, galleries, and other complex parameters.
- Bootstrap 5: Generate views that can use the Bootstrap components included with Joomla.
- AJAX endpoints and models: Optionally generate handlers that validate sessions and CSRF tokens using
JsonResponse.
Stop creating folders and namespaces by hand. Let the generator create the foundation so you can focus on your module's code and design.