Wire Genie 🧞
Autowiring Tool & Dependency Provider for PSR-11 service containers Wire with genie powers.
💿
composer require dakujem/wire-genie
What?
A superpowered call_user_func
? Yup! And more.
Wire Genie uses your PSR-11 service container to "magically" provide arguments (dependencies).
Allows you to:
- invoke any callables
- construct any objects
... with high level of control over the arguments. 💪
Usage
$container = new Any\Psr11\Container([
Thing::class => new Thing()
MyService::class => new MyService(),
]);
$callable = function (MyService $service, Thing $thing){ ... };
class Something {
public function __construct(MyService $service, Thing $thing) { ... }
}
$g = new Dakujem\Wire\Genie($container);
// Magic! The dependencies are resolved from the container.
$value = $g
…