2017 © Pedro Peláez
 

library invoker

Build and Invoke Classes

image

kodcube/invoker

Build and Invoke Classes

  • Sunday, April 2, 2017
  • by srmiles
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Invoker for Callable Classes & Methods

This can construct & call a method on a passed passed classname::method string., (*1)

This library is great for command bus, event bus or message bus processing, where by just passing a class name and method as a string can be instanciated and executed., (*2)

Usage & Examples

Construct

$invoker = new KodCube\Invoker\Invoker();

Callable Object

$invoker = new KodCube\Invoker\Invoker();

$result = $invoker('MyClass');

is the same as, (*3)

$class = new MyClass();
$result = $class();

Public Method on Object

$invoker = new KodCube\Invoker\Invoker();

$result = $invoker('MyClass::myMethod');

is the same as, (*4)

$class = new MyClass();
$result = $class->myMethod();

Public Method on Object with constructor arguments

$invoker = new KodCube\Invoker\Invoker();

$result = $invoker('MyClass::myMethod',null,['arg1','arg2']);

is the same as, (*5)

$class = new MyClass('arg1','arg2');
$result = $class->myMethod();

Public Method on Object with method arguments

$invoker = new KodCube\Invoker\Invoker();

$result = $invoker('MyClass::myMethod',['arg1','arg2']);

is the same as, (*6)

$class = new MyClass();
$result = $class->myMethod('arg1','arg2');

Public Static Method

$invoker = new KodCube\Invoker\Invoker();

$result = $invoker('MyClass::myMethod');

is the same as, (*7)

$result = MyClass::myMethod();

The Versions

02/04 2017

dev-master

9999999-dev

Build and Invoke Classes

  Sources   Download

MIT

The Requires

 

The Development Requires

php callable dependency-injection dependency injection invoke invoker

19/07 2016

0.1.1

0.1.1.0

Build and Invoke Classes

  Sources   Download

MIT

The Requires

 

The Development Requires

php callable dependency-injection dependency injection invoke invoker

17/07 2016

0.1.0

0.1.0.0

Build and Invoke Classes

  Sources   Download

MIT

The Requires

 

The Development Requires

php callable dependency-injection dependency injection invoke invoker