PHP code example of sassnowski / yii-provider-registry

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

    

sassnowski / yii-provider-registry example snippets


$app = new yii\web\Application($config)

(new \Sassnowski\Yii2\ProviderRegistry\ProviderRegistry(\Yii::$container))->bootstrap();

$app->run();



return [
    \Acme\Providers\MyProvider::class,
    \Acme\Providers\AnotherProvider::class,
    \Acme\Providers\Mailing\MailProvider::class,
];



namespace Acme\Providers;

use yii\di\Container;

class MyProvider
{
    public function bootstrap(Container $container)
    {
        $container->set(
            \Acme\Services\MySickServiceInterface::class,
            \Acme\Services\MySickServiceImplementation::class
        );
    }
}