Skip to content

Instantly share code, notes, and snippets.

View hakuno's full-sized avatar

Seiji 誠 次 hakuno

  • Brazil
  • 16:50 (UTC -03:00)
View GitHub Profile
<?php
namespace App\Http\Controllers;
use Symfony\Component\HttpFoundation\BinaryFileResponse; // http://api.symfony.com/4.0/Symfony/Component/HttpFoundation/BinaryFileResponse.html
use Symfony\Component\HttpFoundation\File\Stream; // https://api.symfony.com/3.4/Symfony/Component/HttpFoundation/File/Stream.html
use SplFileObject;
use Exception;
// https://symfony.com/doc/current/components/http_foundation.html
@hakuno
hakuno / Laravel-Container.md
Created July 3, 2018 22:04
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container