PHP code example of technically / array-container

1. Go to this page and download the library: Download technically/array-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/ */

    

technically / array-container example snippets




use Technically\ArrayContainer\ArrayContainer;

// ... instantiate your services: $logger, $cache, $config

// Instantiate with predefined entries
$container = new ArrayContainer([
    'logger' => $logger,
    'cache'  => $cache,
]);

// Add more entries later
$container->set('config', $config);

// Get entries from it later in your code
$logger = $container->get('logger');