Skip to content

Instantly share code, notes, and snippets.

View elkebirmed's full-sized avatar

Mohamed Elkebir elkebirmed

  • El-Affroun, Blida,, Algeria
View GitHub Profile
<?php
Route::group(['prefix' => '{lang}'], function () {
// ...
});
example.com
example.com/fr
example.com/ar
<?php
Localizater::group(function () {
Route::view('/', 'welcome');
Route::get('/foo', 'Controller@action');
});
Route::delete('foo', 'Controller@action');
Route::post('login', 'Controller@action');
// Result of locales are (en, fr)
@elkebirmed
elkebirmed / Laravel-Container.md
Created August 17, 2020 15:41
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

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).

sAVqdNCosKdBrydeSvmsyRjdIh4wePxqNFiF7IUVCm8htJAnnrf17EQNqBDA6u1+YAQv/YK1Sk2
dNAESDBzmXGSE+7Ea7IWvvBNVZguivN7l3lsPC9684SRzBSSNlzg/SLPf0kE2ZSu1Rw5kkgOzra
mKk4O7aASh4XJB4kB7oKEfjHFCBJ5S0T0cI9yqCMGAzWpxl5jHp4zVeX4rUCkfBh43sdlQlghyy
sE4uT15OXVMkBpv4wZLyTIGOjAvjUiOKgmTLsglMQ7fg2Lgf90tbMGWw2KKBXiGg25aoVHhU6R6
Gdk9CeqiLgp1WWEBzBb9qrkHKIbBJJBfpulRSV1fHQ==