Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chrisharrison/merged-container
A PSR-11 compliant container that merges a set of PSR-11 containers. You might call it a container-container.
https://github.com/chrisharrison/merged-container
containers ioc php7 psr-11
Last synced: 12 days ago
JSON representation
A PSR-11 compliant container that merges a set of PSR-11 containers. You might call it a container-container.
- Host: GitHub
- URL: https://github.com/chrisharrison/merged-container
- Owner: chrisharrison
- Created: 2017-12-01T10:21:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-01T16:32:20.000Z (about 7 years ago)
- Last Synced: 2024-12-09T18:03:32.333Z (about 1 month ago)
- Topics: containers, ioc, php7, psr-11
- Language: PHP
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# merged-container
[![Build Status](https://travis-ci.org/chrisharrison/php-array-of.svg?branch=master)](https://travis-ci.org/chrisharrison/php-array-of)
A [PSR-11](http://www.php-fig.org/psr/psr-11/) compliant container that merges a set of PSR-11 containers. You might call it a container container.
## Requirements ##
Requires PHP 7.1
## Installation ##
Through Composer, obviously:
```
composer require chrisharrison/merged-container
```## Why? ##
The [PSR-11](http://www.php-fig.org/psr/psr-11/) container interface have the following properties:
* It's immutable. That means it can't be changed after it's been instantiated.
* It doesn't provide an iteration mechanism.These two properties mean it's difficult to create a container which is a merge of two or more PSR-11 containers.
This library provides a container which implements the PSR-11 interface. It's constructed by an array of other PSR-11 containers. These containers can use any concrete implementation ([PHP-DI](https://github.com/PHP-DI/PHP-DI), [Pimple](https://github.com/silexphp/Pimple)) as long as they implement the PSR-11 interface.
## Usage ##
Create a merged container:
```php
$merged = new MergedContainer([$container1, $container2]);
```Use it like any other PSR-11 container.