Module development guide

Module structure

Modules fundamentally consist of a directory, which contains:

  • module.yaml REQUIRED -- A Yaml file specifying this module's configuration, and any additional configuration to merge into the site configuration. It consists of two primary portions:
    • Configuration options under module key specify information about this module, and are only available within this file for the purposes of bootstrapping the module.
    • All other data in module.yaml is merged into the site's config, after resolving any references to the module portion.
  • src/ -- a directory that will have a PHP autoloader registered to point at it, under the namespace Digraph\Modules\\\[module directory name]
  • routes/ -- a directory where the module can specify its own routes
  • templates/ -- a directory where a module can define its own templates
  • media/ -- a directory where a module can provide its own media files

Loading modules

Modules in Digraph can be loaded in two different ways, both of which are controlled in your site's Configuration options.

Module directories

Modules can be loaded automatically from