dev-master
9999999-dev https://github.com/hixman/psr-containerA psr-11 container implementation
MIT
The Requires
- php ~5.6|~7.0
The Development Requires
by Hixman
hixman psr-container
A psr-11 container implementation
![Software License][ico-license]
![Total Downloads][ico-downloads], (*1)
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors., (*2)
Via Composer, (*3)
``` bash $ composer require hixman/psr-container, (*4)
## Usage **Basic Usage** ``` php $container = new Container(); $container->set(UserRepository::class, function(){ return new UserRepository(); }); $userRepositoryExits = $container->has(UserRepository::class; $userRepository = $container->get(UserRepository::class);
Delegated Repository, (*5)
Only delegated container lookup., (*6)
``` php $container = new Container(); $delegatedContainer = new Container(); $container->setDelegatedContainer($delegatedContainer); $container->set(UserRepository::class, function(){ return new UserRepository(); }); $userRepositoryExits = $container->has(UserRepository::class; // False $userRepository = $container->get(UserRepository::class); // Throws NotFoundException, (*7)
Delegated container and itself lookup ``` php $container = new Container(); $delegatedContainer = new Container(); $container->setDelegatedContainer($delegatedContainer, DelegableInterface::NOT_ONLY_DELEGATED); $container->set(UserRepository::class, function(){ return new UserRepository(); }); $userRepositoryExits = $container->has(UserRepository::class; // True $userRepository = $container->get(UserRepository::class); // A new instance of UserRepository
Please see CHANGELOG for more information what has changed recently., (*8)
bash
$ composer test
, (*9)
Please see CONTRIBUTING and CONDUCT for details., (*10)
If you discover any security related issues, please email hixman88@gmail.com instead of using the issue tracker., (*11)
The MIT License (MIT). Please see License File for more information., (*12)
A psr-11 container implementation
MIT
hixman psr-container