PHP code example of tomrf / autowire

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

    

tomrf / autowire example snippets


$autowire = new \Tomrf\Autowire\Autowire();

$instance = $autowire->instantiateClass(MyClassWithDependencies::class, $container);

public function resolveDependencies(
    object|string $classOrObject,
    Psr\Container\ContainerInterface $containers
): array

@throws   \Tomrf\Autowire\AutowireException
@return   (null|object)[]

public function instantiateClass(
    string $class,
    Psr\Container\ContainerInterface $containers
): object

@throws   \Tomrf\Autowire\AutowireException

public function listDependencies(
    object|string $classOrObject,
    string $methodName = '__construct'
): array

@throws   \Tomrf\Autowire\AutowireException
@return   array<string,bool|string>[] Array of parameters with attributes