File Structure

Every Module lives on the filesystem in the _Modules folder and consists of a few file that are mandatory:

In order to show the files, this documentation will use a module named β€œMyModule” in order to show what naming-schema must be used.

β”œβ”€β”€ _Modules/
β”‚   β”œβ”€β”€ MyModule/
β”‚   β”‚   β”œβ”€β”€ _migrations/
β”‚   β”‚   β”œβ”€β”€ _views/
β”‚   β”‚   β”œβ”€β”€ Controllers/
β”‚   β”‚   β”œβ”€β”€ Helpers/
β”‚   β”‚   β”œβ”€β”€ module.json
β”‚   β”‚   β”œβ”€β”€ module_meta.json
β”‚   β”‚   β”œβ”€β”€ MyModule.php

The module.json file is just filled with {}, sice we currently don’t need to write anything in here.

The module_meta.json holds all the meta-information that the core needs in order to determine the functionality of the Module:

{
  "name": "BlankModule",
  "version": "1.0.0",
  "needsInstallation": true,
  "checkInstallation": "Module\\BlankModule\\BlankModule::checkInstallationStatus",
  "installInstallation": "Module\\BlankModule\\BlankModule::installModule",
  "cronjobTask": "Module\\BlankModule\\Cron\\Cronjob::__execute"
}

We have a few important fields here. As you might have guessed, name and version hold the information about what the name of the module is and what version is currently installed. We also have the flag needsInstallation, indicating to the core that there is a function that needs to be executed in order for the module to work correctly. checkInstallation and installInstallation defines two function, the first will be used in order to determine if there is something that needs to be done in order to fully install the module. This can be something like database migrations or file movement. The installInstallation does the actual work and will only be invoked when the checkInstallation returns false.

Lastly we have the cronjobTask instruction, which tells the core that there is a function that needs to be executed. Cronjob tasks will be executed every minute, so in order to have a task run every 10 minutes you need to do some modulo math.

support

Do you require help?

Wether you have encountered a Bug, ran into a problem setting something up or require generall assistance using some of the features, we want to help you with that.

On our Discord-Server you can ask for help of any kind, suggest new ideas for our products or just hangout and chat!

Open Discord