starbug / modules
A very simple module management layer.
Installs: 3 927
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- composer/installers: ^1.10
- starbug/composer-modules-plugin: ^0.8
Requires (Dev)
- starbug/devel: ^1.0
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
- composer/installers Composer installer plugin to place modules outside of vendor.
- starbug/composer-modules-plugin Composer plugin to generate an ordered module list.
- starbug/modules Includes a simple interface for runtime module management.
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.