The method instance creates an object that support the specified interface.
By each request, a new object is created. If you request data objects like User, a separate instance must be created for each item.
| Name | Pass type | Value type | Default value | Description |
|---|---|---|---|---|
| $interface_or_class | by value | string|object |
Name of the class/interface as string or the class/interface. |
|
| $context | by value | string | "default" |
The context of binding. You can introduce a different context, and bind another implementation. Then, you can request another instance specifying the context explicitly. |
Returns object of the class bound to the interface.
It might throw the following exceptions in the case of any errors: