icecave/evoke

A library for invoking PHP callables using positional and named arguments.

1.0.0 2014-09-09 04:59 UTC

This package is auto-updated.

Last update: 2024-10-29 03:48:16 UTC


README

Build Status Code Coverage Latest Version

Evoke is a small PHP library for invoking callables using positional and named parameters, a little like Python's *args, **kwargs syntax.

composer require icecave/evoke

Example

use Icecave\Evoke\Invoker;

$invoker = new Invoker;

$func = function ($a, $b, $c = 30, $d) {
    return array($a, $b, $c, $d);
};

$positionalArguments = array(10, 20);
$keywordArguments = array('d' => '40');

$result = $invoker->invoke($func, $positionalArguments, $keywordArguments);

assert($result === array(10, 20, 30, 40));