Laravel Service Container: Service Container: Binding Interfaces To Implementations

Service Container: Binding Interfaces To Implementations

$this->app->bind(
    'App\Contracts\EventPusher',
    'App\Services\RedisEventPusher'
);
Use App\Contracts\EventPusher;

/**
 * Create a new class instance.
 *
 * @param  EventPusher  $pusher
 * @return void
 */
public function __construct(EventPusher $pusher)
{
    $this->pusher = $pusher;
}

Related concepts

Service Container: Binding Interfaces To Implementations

Laravel Service Container: Service Container: Binding Interfaces To Implementations — Structure map

Clickable & Draggable!

Laravel Service Container: Service Container: Binding Interfaces To Implementations — Related pages: