PHP code example of dantleech / invoke

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

    

dantleech / invoke example snippets




use DTL\Invoke\Invoke;

class Foobar
{
    public function __construct(string $arg1, string $arg2 = 'val1')
    {
    }
}

$foo = Invoke::new(Foobar::class, [
    'arg1' => 'value1'
]);



use DTL\Invoke\Invoke;

class Foobar
{
    // ...

    public function one(string $two)
    {
    }
}

$foo = Invoke::new(Foobar::class, [
    'arg1' => 'value1'
]);

$bar= Invoke::method($foo, 'one', [
    'two' => 'bar'
]);