bnf / di
Dependency injection container with PSR-11 and container-interop/service-provider support
Installs: 1 515
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.0
- container-interop/service-provider: ~0.4.0
- psr/container: ^1.0
Requires (Dev)
- php: ^7.1
- jangregor/phpstan-prophecy: ^0.3.0
- php-coveralls/php-coveralls: ^2.0
- phpspec/prophecy: ^1.7
- phpstan/phpstan: ^0.11.1
- phpstan/phpstan-phpunit: ^0.11.0
- phpstan/phpstan-strict-rules: ^0.11.0
- phpunit/phpunit: ^6.5 || ^7.0
- squizlabs/php_codesniffer: ^3.4
Provides
This package is auto-updated.
Last update: 2024-10-21 07:38:58 UTC
README
Provides PSR-11 and container-interop/service-provider support.
Installation
$ composer require bnf/di:~0.1.0
Usage
<?php require 'vendor/autoload.php'; use Bnf\Di\Container; use Psr\Container\ContainerInterface; use Interop\Container\ServiceProviderInterface; $container = new Container([new class implements ServiceProviderInterface { public function getFactories(): array { return [ stdClass::class => function (ContainerInterface $container): stdClass { return new stdClass; } ]; } public function getExtensions(): array { return []; } }]); $class = $container->get(stdClass::class); var_dump($class);