pengboomouch / audere
Automatic Dependency Resolution
dev-main
2023-03-20 12:31 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-05-20 17:22:47 UTC
README
Automatic Dependency Resolution
Install
composer require pengboomouch/audere
Basic usage
$myClass = $container->get('MyClass'); $myClass->doSomethingUseful();
With attribute Injection
use Audere\Inject; class MyAttributeClass { private string $sayHello; public function __construct( #[Inject('say.hello')] $sayHello ) { $this->sayHello = $sayHello; } public function getGreeting(): string { return $this->sayHello; } } $builder = new InjectionBuilder(); $builder->add('say.hello', 'Hello World'); $container = new Audere\Container($builder); $myAttributeClass = $container->get('MyAttributeClass'); echo $myAttributeClass->getGreeting(); //prints: Hello World