PHP code example of kusabi / container

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

    

kusabi / container example snippets


use Kusabi\Container\Container;

// Create a new instance
$container = new Container();

// Set and get items
$container->set('integer', 1);
$container->get('integer'); // 1

// Set values by reference
$array = [1, 2, 3];
$container->setReference('array', $array);
$array[] = 4;
$container->get('array'); // [1, 2, 3, 4]