PHPackages                             ellipse/container-overridden - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. ellipse/container-overridden

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

ellipse/container-overridden
============================

Psr-11 container decorator allowing to override container entries at runtime

1.0.1(8y ago)02012MITPHPPHP &gt;=7.0

Since Dec 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ellipsephp/container-overridden)[ Packagist](https://packagist.org/packages/ellipse/container-overridden)[ Docs](https://github.com/ellipsephp/container-overridden)[ RSS](/packages/ellipse-container-overridden/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (3)Used By (2)

Overridden container
====================

[](#overridden-container)

This package provides a **[Psr-11 container](http://www.php-fig.org/psr/psr-11/)** decorator allowing to override container entries at runtime.

**Require** php &gt;= 7.0

**Installation** `composer require ellipse/container-overridden`

**Run tests** `./vendor/bin/kahlan`

- [Decorating a container](#decorating-a-container)

Decorating a container
----------------------

[](#decorating-a-container)

This package provides a `Ellipse\Container\OverriddenContainer` class which can be used to decorate any Psr-11 container. It takes an associative array of alias =&gt; values pairs as second parameter. Once decorated, the container `->has()` method will return true when the given alias is a key of this array and the `->get()` method will return its associated value. When the alias is not a key of the array, the original container `->has()` and `->get()` methods are used.

It is especially useful when used with [ellipse/container-reflection](https://github.com/ellipsephp/container-reflection).

```
