Understanding the module file structure
Modules in Joomla! are inside the modules
folder of our site. In any typical Joomla! installation, this folder is full of folders that belong to the modules. These folder names start with the prefix mod_
to emphasize they are a module. This is not a rule when naming our modules, but Joomla! will add the prefix to the folder name if not present.
Since Joomla! 4, the module architecture has been the same as the component architecture.
So, when calling a module, Joomla! will look for the provider.php
file inside the service modules. In the provider.php
file, we will register the services we need in our module.
After registering our services, Joomla! looks for our module’s Dispatcher.php
file, which will be inside the src/Dispatcher/
folder of our module. We will need a folder structure as follows:
services
: This folder contains theprovider.php
file. This file is likesrc/component/admin/services/provider.php
, and it’...