PHP code example of corex / ioc

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

    

corex / ioc example snippets


// Create new container.
$container = new Container();

// Create/use existing container.
$container = Container::getInstance();

$myClass = Container::getInstance()->make(MyClass::class);

$container = Container::getInstance();

$container->bind(MyClassInterface::class, MyClass::class);

$myClass = $container->make(MyClass::class, [
    'test' => 'my.value'
]);