Download the PHP package amber/container without Composer
On this page you can find all versions of the php package amber/container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package container
Container
Simple PHP DI Container.
Instalation
API (Draft)
Basic Usage (PSR-11 compliance)
bind()
Binds an item to the Container's map by a unique key.
bind(string $key, mixed $value) : boolean
param string $key The unique item's key.
param mixed $value The value of the item.
return bool True on success. False if key already exists.
Bind an Service to the container by a unique key.
Or bind a class like this.
get()
Gets an item from the Container's map by its unique key
get(string $key): mixed
param string $key *The unique item's key.
return mixed The value of the item.
has()
Checks for the existance of an item on the Container's map by its unique key.
has(string $key): bool param string $key *The unique item's key. return bool
unbind()
Unbinds an item from the Container's map by its unique key.
unbind(string $key): bool
param string $key *The unique item's key.
return bool true on success, false on failure.
Multiple actions
bindMultiple()
getMultiple()
unbindMultiple()
Advanced Usage
make()
Binds and Gets a Service from the Container's map by its unique key.
make(string $class): mixed
param string $class The item's class.
return mixed The value of the item.
register()
Binds an class to the Container and return the ServiceClass.
register(string $class, string $alias = null): ServiceClass
param string $class The item's class.
param string $alias The item's alias.
return ServiceClass
singleton()
Binds an class to the Container as singleton and return theServiceClassservice.
singleton(string $class, string $alias = null): ServiceClass
param string $class The item's class.
param string $alias The item's alias.
return ServiceClass
getClosureFor()
Gets a closure for a method of the provided class.
getClosureFor(string $class, string $method, array $binds = []): Closure
param string $class The class to instantiate.
param string $method The class method to call.
param array $binds The arguments for the service.
return Closure
More coming soon...
All versions of container with dependencies
amber/collection Version ^0.6@beta
amber/validator Version ^0.1@dev
opis/closure Version ^3.5
psr/container Version ^1.0