load()

public function load(string $target_module): void

Description

Loads a module by instantiating its controller.

Parameters

Parameter Type Description Default
$target_module string The name of the target module. N/A

Return Value

Type Description
void No return value.

Example Usage

PHP
$module_loader = new Modules();
$module_loader->load('welcome');

Alternative Technique

The main Trongate class provides the module() method as a more convenient alternative. This method offers a semantically clear approach for developers, ensuring the codebase remains expressive and maintainable.

Example Usage of Alternative Technique

PHP
// From a controller extending Trongate
$this->module('welcome');

Static Access

The Modules class can also be used directly via its static method:

PHP
Modules::run('welcome/index');