Container Injection interface

interface Slick\Di\ContainerInjectionInterface

This is an easy way of creating a class that the dependency container will know how to instantiate. It has a single method and it enforces the constructor dependency injection pattern.

static create($container)

Instantiates a new instance of this class.

Parameters:
  • $container (Interop\Container\ContainerInterface) – The service container this instance should use.
Returns:

A new instance of this class.

Tip

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.