PHP code example of phpactor / container

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

    

phpactor / container example snippets


$container = new PhpactorContainer([
     'param1' => 'value1',
     'param2' => 'value2',
     // ...
]);

$container->register('Foobar', function (Container $container) {
    return new MyClass(
        $container->get(SomeOtherClass::class),
        $container->getParameter('param1')
    );
};