PHP code example of marm / yamm

1. Go to this page and download the library: Download marm/yamm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marm / yamm example snippets


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

/** @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')
    );
};

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