PHP code example of kyrill / php-di-container

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

    

kyrill / php-di-container example snippets



use Kyrill\DIContainer\Container;
$container = new Container();


$container->register('name', new ClassDefinition('namespace\\classname/', ['argument1', 'argument2'], true));


$classRegister = new ClassRegistar();
$classRegister->registerFile('.\di.json', new JsonFileReader(), $container);


$container->resolve(Classname::class);

composer