2017 © Pedro Peláez
 

oxid-module yamm

image

marm/yamm

  • Monday, July 23, 2018
  • by marmalade
  • Repository
  • 4 Watchers
  • 1 Stars
  • 5,328 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 16 Versions
  • 16 % Grown

The README.md

YAMM :: Yet Another Meta Module

English

This meta module provides generally desired functionality, like:, (*1)

  • A reusable Dependency Injection Container, (*2)

  • Sensible logging facilities, (*3)

DIC Usage

The DIC is an extension of Pimple which allows service tagging and is integrated with Oxid eSales., (*4)

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:, (*5)

/** @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:, (*6)

/** @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"
        $dic->getTagged('acme:tag')
    );
};

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

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

Licence Terms

YAMM is released under MIT., (*8)

Use this module in your project but keep the author notice. Thank you!, (*9)

Authors

The Versions