Loads and manages all modules in ProcessWire.

The $modules API variable is most commonly used for getting individual modules to use their API.

// Getting a module by name
$m = $modules->get('MarkupPagerNav');

// Getting a module by name (alternate)
$m = $modules->MarkupPagerNav;

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Modules class also inherits all the methods and properties of: WireArray and Wire.

Common / Manipulation / Configuration

Show “$modules”             Show Arguments        

Common

NameReturnSummary 
$modules->findByPrefix(string $prefix)
arrayFind modules matching the given prefix (i.e. “Inputfield”)
$modules->get($key)
Module, _Module or nullGet the requested Module
$modules->getModule($key)
Module, _Module or nullGet the requested Module (with options)
$modules->getModuleFile($class)
bool or stringGet the path + filename (or optionally URL) for this module
$modules->getModuleInfo($class)
arrayReturns an associative array of information for a Module
$modules->getModuleInfoVerbose($class)
arrayReturns a verbose array of information for a Module
$modules->isInstalled(string $class)
boolIs the given module name installed?

Manipulation

NameReturnSummary 
$modules->delete(string $class)
bool or intDelete the given module, physically removing its files
$modules->install(string $class)
null or ModuleInstall the given module name
$modules->refresh()
(nothing)Refresh the modules cache
$modules->saveConfig($class, $data)
boolSave provided configuration data for the given module
$modules->uninstall(string $class)
boolUninstall the given module name

Configuration

NameReturnSummary 
$modules->getConfig($class)
arrayGiven a module name, return an associative array of configuration data for it
$modules->isConfigurable($class)
bool, string or intIs the given module configurable?
$modules->saveConfig($class, $data)
boolSave provided configuration data for the given module

Additional methods and properties

In addition to the methods and properties above, Modules also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.60