Yet Another Meta Module
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Use configured shop compile dir for cache file Mar 6, 2018
tests/Yamm Added license file and headers Nov 9, 2016
.gitignore Added license file and headers Nov 9, 2016
.gitlab-ci.yml Removed cleancode rule set Sep 30, 2016
LICENSE Added license file and headers Nov 9, 2016
changelog.txt Added base project files Sep 29, 2016
composer.json Merge remote-tracking branch 'origin/master' Nov 28, 2016
composer.lock Added installer name Nov 28, 2016
marmalade.jpg Added base project files Sep 29, 2016
metadata.php Updated version number Feb 8, 2018
phpunit.xml Only generate coverage for Yamm source files Sep 29, 2016 Added some clarifications and type hints to the readme Nov 9, 2016

YAMM :: Yet Another Meta Module


This meta module provides generally desired functionality, like:

  • A reusable Dependency Injection Container

  • Sensible logging facilities

DIC Usage

The DIC is an extension of Pimple which allows service tagging and is integrated with Oxid eSales.

To use the DIC just put a dic.php in the root of yourproject and register all your services in there. A variable $dic will be available in this fileyou can operate with:

/** @var \Marm\Yamm\DIC $dic */
$dic['acme_module_service'] = function (\Marm\Yamm\DIC $dic) {
    return new Acme\Module\Service(/* ... */);

On top of that we allow tagging of services and receiving of all services which are tagged with a defined tag when constructing services:

/** @var \Marm\Yamm\DIC $dic */
$dic->tag('acme_module_service', 'acme:tag');
$dic['acme_module_service'] = function (\Marm\Yamm\DIC $dic) {
    return new Acme\Module\Service(/* ... */);

// Somewhere else or later
$dic['acme_module_aggregator'] = function (\Marm\Yamm\DIC $dic) {
    return new Acme\Module\Aggregator(
        // Array of all services tagged with "acme:tag"

To get the DIC anywhere else in your project, just fetch it from oxRegistry:

/** @var \Marm\Yamm\DIC $dic */
$dic = oxRegistry::get('yamm_dic');

Licence Terms

YAMM is released under MIT.

Use this module in your project but keep the author notice. Thank you!