2017 © Pedro Peláez
 

library invoker

Invoke callables using associative arrays

image

marcojetson/invoker

Invoke callables using associative arrays

  • Saturday, May 30, 2015
  • by marcojetson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Invoker

Invoke PHP callables using associative arrays, (*1)

Build status Test coverage, (*2)

Usage

Use invoke providing a callable and the arguments as an associative array, (*3)

function person($name, $age)
{
}

$invoker = new Invoker();
$invoker->invoke('person', ['age' => 29, 'name' => 'Marco']);

Supports optional arguments, (*4)

function person($name, $age = 29)
{
}

$invoker = new Invoker();
$invoker->invoke('person', ['name' => 'Marco']);

Callables

In addition to PHP callables you can use the following forms as first argument:, (*5)

  • A class name implementing the __invoke magic method
  • A string containing class::method

You can implement Resolver interface and inject it into Invoker's constructor for adding your own forms, (*6)

$invoker = new Invoker(new MyResolver());

The Versions

30/05 2015

dev-master

9999999-dev

Invoke callables using associative arrays

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6

 

The Development Requires

invoke invoke args