PHP code example of gobline / injector

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

    

gobline / injector example snippets


$injector = (new Gobline\Injector\TraitDependencyInjector())
    ->register("Dependency\\ServiceATrait", function ($o) use ($dic) { $o->setServiceA($dic['service.a']); });
    ->register("Dependency\\ServiceBTrait", function ($o) use ($dic) { $o->setServiceB($dic['service.b']); });

$injector->inject($consumer);