PHP code example of mouf / alias-container
1. Go to this page and download the library: Download mouf/alias-container 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/ */
mouf / alias-container example snippets
use Mouf\AliasContainer;
use Interop\Container\ContainerInterface;
$aliasContainer = new AliasContainer($rootContainer, [
"myAlias"=>"myInstance",
"myAlias2"=>"myInstance2"
]);
$myInstance = $aliasContainer->get('myAlias');
$aliasContainer->set('newAlias', 'myInstance');
$aliasContainer->remove('myAlias');