API Reference
Container
Namespace: WPZylos\Framework\Container
Implements: Psr\Container\ContainerInterface
Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
bind | string $id, callable|string|null $concrete = null | Definition | Register factory binding |
singleton | string $id, callable|string|null $concrete = null | Definition | Register singleton |
add | string $id, callable|string|null $concrete = null | Definition | Alias for bind |
addShared | string $id, callable|string|null $concrete = null | Definition | Alias for singleton |
alias | string $alias, string $id | static | Create service alias |
tag | array $ids, string $tag | static | Tag multiple services |
tagged | string $tag | array | Get services by tag |
get | string $id | mixed | PSR-11: Resolve service |
has | string $id | bool | PSR-11: Check existence |
forget | string $id | bool | Remove service |
keys | — | string[] | List registered IDs |
Definition
Namespace: WPZylos\Framework\Container
Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
share | — | static | Make singleton |
addTag | string $tag | static | Add tag |
hasTag | string $tag | bool | Check tag |
isShared | — | bool | Is singleton? |
isResolved | — | bool | Has cached instance? |
getId | — | string | Get identifier |
getConcrete | — | callable|string | Get factory/class |
getResolved | — | mixed | Get cached instance |
setResolved | mixed $instance | void | Cache instance |
Exceptions
ContainerException
Namespace: WPZylos\Framework\Container\Exceptions
Implements: Psr\Container\ContainerExceptionInterface
Thrown when:
- Circular dependency detected
- Class not instantiable
- Auto-wiring fails
NotFoundException
Namespace: WPZylos\Framework\Container\Exceptions
Implements: Psr\Container\NotFoundExceptionInterface
Thrown when service ID not found and not auto-wireable.