starbug/modules

A very simple module management layer.

v0.8.1 2021-01-16 23:52 UTC

This package is auto-updated.

Last update: 2024-10-17 07:52:46 UTC


README

This package brings together components for a module system. The main component is starbug/composer-modules-plugin, to which this package adds some more opinionated runtime interfaces.

What's included

Usage

// vendor/modules.php is generated by starbug/composer-modules-plugin from the installed composer packages.
$modules = include("vendor/modules.php");

$config = new Starbug\Modules\Configuration($modules);

// Enable a module
$config->enable("my-module");

// Disable a module
$config->disable("my-module");

// Enable multiple modules
$config->enableAll(["type" => "module"]);

// Disable multiple modules
$config->disableAll(["type" => "theme"]);

// Get enabled modules
$config->getEnabled();

// Get all modules
$config->getModules();

// Get module properties
$config->get("my-module")

// Get module property
$config->get("my-module", "path");

Note that vendor/modules.php is the list of registered modules. See starbug/composer-modules-plugin for details on how it's generated.

For composer/installers to work, you must be using one of the predefined package types.