PHP code example of chkt / eve

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

    

chkt / eve example snippets


use \eve\common\factory\BaseFactory;
use \eve\driver\InjectorDriverFactory;

$base = new BaseFactory();
$factory = $base->produce(InjectorDriverFactory::class, [ $base ]);
$driver = $factory->produce([...]);

$injector = $driver->getInjector();

$object = $injector->produce(\namespace\ClassName::class, [...]);

use eve\access\ITraverableAccessor;
use eve\inject\IInjectable;
use eve\inject\IInjector;

class ExampleClass
implements IInjectable
{
  
  static public function getDependencyConfig(ITraversableAccessor $config) {
    return [
      'injector:',
      'providerName:providableObject?key=value',
      [
        'type' => 'argument',
        'data' => $config->hasItem('options') ? $config->getItem('options') : []
      ]
    ];
  }
  
  public function __construct(IInjector $injector, ProvidableObject $object, array $options) {
  
  }
}

$injector->produce(\exampleNamespace\ExampleClass::class, [ 'options' => [...] ]);

$injector->produce(\exampleNamespace\ExampleClass::class);
bash
$ php composer.phar install chkt/eve