webspot/modulemanager

This package is abandoned and no longer maintained. No replacement package was suggested.

Webspot Module Manager library

2.0.0-alpha2 2015-06-23 16:47 UTC

This package is not auto-updated.

Last update: 2015-11-28 06:29:24 UTC


README

Build Status Code Climate Test Coverage

The ModuleManager allows you to split up your code into logical modules and still be able to easily use them together. It integrates seamlessly with the Webspot Application package but has no dependency on it. The ModuleManager is however heavily dependent upon Composer's autoloader and needs it to be instantiated, after which it will add any Module path for autoloading when the Module is added to the ModuleManager.

The Module object

A Module is a simple object describing the Namespace and local root path of the module.

The base interface consists just of the methods necessary to make this possible: getNamespace() to return the base namespace; getPath() to get the module's root path; and finally getFile() to find a file path within the Module.

The ModuleManager

The ModuleManager keeps track of added Modules and helps you find files across modules. You can retrieve individual modules by their Namespace or get all of them in an array. Modules are prioritized in reverse order (this is implemented using the SplStack) from which they were added, thus the last in is the first to be checked with getFile()/getFiles() or in the array returned from getModules(). Modules can be added by using $moduleManager->addModule($module); where the $module is a configured Webspot\ModuleManager\ModuleInterface object.