crocodile2u's avatar
  • Popularity: 0 points
  • Activity: 60 points
  • Age: 40
  • Pronoun: He/Him/His
  • Joined: 123 days ago
  • Last Login: 27 days ago
  • Profile viewed: 192 times
  • Has watched: 0 videos
Contact crocodile2u
  1162 views · 65 days ago

![Custom extension to Laravel Application class](

Hello folks! This post is for those of you using Laravel. This beautiful framework makes web development super-easy compared to most of competitors. In the heart of Laravel is the Application class, which is responsible for bootstrapping, registering services and also serves as a dependency injection container. What I do with my Laravel apps, is that I take a slight detour from the common path by adding a custom Application class. While this is not really necessary, I find this approach nice, and will try to share my thought below.

It's normal practice in Laravel world to build all kinds of objects like this:


$cache = app("cache");


I find it a bit confusing to call `app("cache"")` and expect a `Cache\Repository` instance as result....