2017 © Pedro Peláez
 

library psr-container

A psr-11 container implementation

image

hixman/psr-container

A psr-11 container implementation

  • Thursday, July 27, 2017
  • by hix
  • Repository
  • 0 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

psr-container

Latest Version on Packagist ![Software License][ico-license] Build Status ![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)

Install

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

Change log

Please see CHANGELOG for more information what has changed recently., (*8)

Testing

bash $ composer test, (*9)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*10)

Security

If you discover any security related issues, please email hixman88@gmail.com instead of using the issue tracker., (*11)

Credits

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

27/07 2017

dev-master

9999999-dev https://github.com/hixman/psr-container

A psr-11 container implementation

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

by Hixman

hixman psr-container