PHP code example of bartfeenstra / dependency-retriever

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

    

bartfeenstra / dependency-retriever example snippets


use Psr\Log\LoggerInterface;

class Bar {

  /**
   * @suggestedDependency drupalContainerService:logger.channel.form $formLogger
   */
  public function __construct(LoggerInterface $formLogger, $severity) {
    // ...
  }

}

$factory = new SimpleFactory(new AnnotatedFinder(), new DrupalContainerServiceRetriever());
$bar = $factory->instantiate(Bar::class, [
  'severity' => LogLevel::WARNING,
]);