PHP code example of redot / container

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

    

redot / container example snippets


use Redot\Container\Container;

$container = new Container();

$container = Container::getInstance();

$container->bind(Foo::class);

$container->singleton('foo', function () {
    // ...
});

$foo = $container->make('foo');

$container->alias(Foo::class, 'bar');

$container->make(BrandNewClass::class);

$container->call([Foo::class, 'setBar'], ['bar' => $bar]);