PHP code example of beige / invoker

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

    

beige / invoker example snippets


use Beige\Invoker\Invoker;
use Beige\Psr11\Container;

$container = new Container([
    'Test' => ...
]);

$invoker = new Invoker($container);
$invoker->call(function(Test $test, $foo) {
    ...
}, ['foo' => 'bar']);

use Beige\Invoker\Invoker;

class Invokeable
{
    public function __construct(Test $test, $foo)
    {
        ...
    }
    ...
}

$instance = $invoker->new(Invokeable::class, ['foo' => 'bar']);

$instance = new Invokeable();

$invoker->callMethod($instance, 'someMethod', ['foo' => 'bar']);