phug / invoker
Typing-based invoker
2.0.1
2023-09-02 09:29 UTC
Requires
- php: >=5.5.0
- phug/event: ^1.4
Requires (Dev)
- phug/compiler: ^1.4
- phug/parser: ^1.4
This package is auto-updated.
Last update: 2026-06-15 18:44:22 UTC
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']