phug/invoker

Typing-based invoker

Maintainers

Package info

github.com/phug-php/invoker

Homepage

Issues

Documentation

pkg:composer/phug/invoker

Statistics

Installs: 111

Dependents: 1

Suggesters: 0

Stars: 0


README

What is Phug Invoker?

Register callbacks with argument class typing and call the invoker to execute only the ones that match a given object.

Installation

Install via Composer

composer require phug/invoker

Usage

class Foo {}
class Bar {}

$invoker = new \Phug\Invoker([
    function (Foo $foo) {
        return 'foo';
    },
    function (Bar $bar) {
        return 'BAR';
    },
]);

$invoker->invoke(new Foo); // ['foo']
$invoker->invoke(new Bar); // ['BAR']