gephart / dependency-injection
Gephart DependencyInjection Component
Installs: 679
Dependents: 6
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/gephart/dependency-injection
Requires
- php: >=7.4
- psr/container: ~2.0.2
Requires (Dev)
- phpmd/phpmd: @stable
- phpstan/phpstan: ^1.7.15
- phpunit/phpunit: 9.5.21
- squizlabs/php_codesniffer: ^3.7.1
README
Dependencies
- PHP >= 7.4
- psr/container == 2.0.2
Instalation
composer require gephart/dependency-injection
Using
class A { public function hello(string $world): string { return "hello " . $world; } } class B { private $a; public function __construct(A $a) { $this->a = $a; } public function render() { return $this->a->hello("world"); } } $container = new \Gephart\DependencyInjection\Container(); $b = $container->get(B::class); $b->render(); // hello world