Download the PHP package northwoods/container without Composer
On this page you can find all versions of the php package northwoods/container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download northwoods/container
More information about northwoods/container
Files in northwoods/container
Package container
Short Description Container wrapper for Auryn dependency injector
License MIT
Informations about the package container
Northwoods Container
Auryn is awesome, so why not use it as a container when packages require it?
Note: This goes completely against the philosophy of not using Auryn as a service locator. This package is only meant to be a pragmatic solution for Auryn users that want to use a package that requires a service locator.
Attempts to be PSR-1, PSR-2, PSR-4, and PSR-11 compliant.
Install
Usage
Configuration
This package provides a InjectorBuilder
that can be used to configure Auryn using separate classes.
The builder takes a list of configuration objects and applies each of them to the injector.
If you prefer to have the injector instantiate the configuration classes, use the LazyInjectorBuilder
:
The builder can then be used to create an Injector
instance:
Note: An existing instance of Auryn can also be provided to the build()
method.
Zend Service Manager Compatibility
This package is compatible with Zend Expressive Container Config:
Note: All injections configured this way will be shared!
An existing Injector
can also be passed into ContainerFactory
:
This can be combined with InjectorBuilder
or LazyInjectorBuilder
to apply
configuration such as define()
calls.
Identifiers
PSR-11 does not require the container identifier to be a class name, while Auryn does. The only exception to this rule in Auryn is that a class alias can be anything. These container "service names" must resolve to a class and will need to be aliased.
For example a package may require a config
entry in the container that is meant to resolve to an array.
This can be achieved by creating a delegate that creates an instance of ArrayObject
:
Now whenever $container->get('config')
is called the ArrayObject
will be returned.
Examples
Additional examples are available in the examples/
directory.
License
MIT
All versions of container with dependencies
psr/container Version ^1.0
container-interop/container-interop Version 1.2.0
rdlowrey/auryn Version ^1.1