Download the PHP package webino/instance-container without Composer
On this page you can find all versions of the php package webino/instance-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webino/instance-container
More information about webino/instance-container
Files in webino/instance-container
Package instance-container
Short Description Class Instance Container implementation.
License BSD-3-Clause
Informations about the package instance-container
Webino Instance Container
Instance Container implementation.
Recommended usage
Instance container should be used in factories to resolve new class instance dependencies. It is not recommended to inject it into objects directly.
Setup
Quick Use
Getting same class instance:
Creating new class instance:
Getting class instance with a factory method:
Setting class instance:
Unsetting class instance:
Binding factory class:
Binding callback factory:
Getting interface default class instance:
Setting alias interface to a class:
Instance creation event handling:
API
InstanceContainer
-
bool has(string $id)
Returns true if the container can return an instance for the given identifier, false otherwise. -
mixed get(string $id)
Returns entry instance of the container by its identifier. -
void set(string $id, mixed $instance)
Set entry instance. -
mixed make(string $id, array<int, mixed> ...$parameter)
Creates new instance. -
void bind(string $id, mixed $binding)
Bind provider to an entry instance. - void alias(string $id, string $alias)
Set alias to an entry instance.
CreateInstanceEvent
-
InstanceContainerInterface getContainer()
Returns instance container. -
string getClass()
Returns instance class. - array getParameters()
Returns instance creation parameters.
InstanceFactory
- mixed createInstance(CreateInstanceEventInterface $event)
Creates new instance.
InstanceFactoryMethod
- mixed static create(CreateInstanceEventInterface $event)
Creates new instance.
Development
Static analysis:
Coding style check:
Coding style fix:
Testing:
Git pre-commit setup:
Addendum
Please, if you are interested in this library report any issues and don't hesitate to contribute. We will appreciate any contributions on development of this library.
All versions of instance-container with dependencies
psr/container Version 1.*
webino/exceptions Version 1.*
webino/event-emitter Version 1.*