Save 37% off PRO during our Black Friday Sale! »

The final Laravel Service Container talk (Laracon Online)

The final Laravel Service Container talk (Laracon Online)

Laravel's service container is one of the most challenging aspects of the framework. I know, because I have been there too. It just didn't click with me for a very long time.

It's a little funny because, at its core, the concept and implementation of a service container are relatively simple compared to other parts of the framework. Yeah, Eloquent, I'm talking about you!

We always talk about the concept, theory, and HOW to use the service container, but that's where I see the issue. It's time to include the WHEN and WHY in the discussion.

My humble goal with this talk is to make it the final service container tutorial you will need!

14d39e65f615fd6dcb9dd44ea7f7995b?s=128

Christoph Rumpel

March 17, 2021
Tweet

Transcript

  1. Welcome

  2. None
  3. @christophrumpel

  4. The final Laravel Service Container talk

  5. THE SERVICE CONTAINER Binding Making Resolving Dependency Injection Inversion Of

    Control IOC Container Providers Singleton Auto-Resolving Facades Interface Binding Context Binding PSR-11 !
  6. FORGET ABOUT THE HOW LETS FOCUS ON THE WHY (AND

    WHEN)
  7. What if there was no Service Container?

  8. Loading Example ...

  9. WHY WE NEED THE SERVICE CONTAINER

  10. WHY WE NEED THE SERVICE CONTAINER Better dependency handling Less

    responsibilities No duplicated code Change the control flow
  11. WHO IS IN CONTROL

  12. WHO IS IN CONTROL

  13. WHO IS IN CONTROL = Inversion Of Control (IOC)

  14. Ok, HOW is important too More Examples

  15. Auto-Resolving Before After

  16. Explicit Binding AppServiceProvider

  17. Facades Before After

  18. Facades Before After

  19. Facades & Fakes Example Time

  20. Extending & Overriding Example Time

  21. src/Illuminate/Foundation/Http/Kernel.php Bind an instance

  22. Singletons AuthServiceProvider

  23. Packages

  24. WHY WE NEED THE SERVICE CONTAINER Better dependencies handling Less

    responsibilities No duplicated code Change the control flow
  25. Resources The Best Introduction To Laravel's Service Container https://bit.ly/3triBqS The

    Service Container, with Christoph Rumpel & Matt Stauffer https://bit.ly/3eIcsT8 4 Ways The Laravel Service Container Helps Us Managing Our Dependencies https://bit.ly/3eOjCFi Mastering The Illuminate Container https://bit.ly/38NAAjr Service Container Fundamentals https://bit.ly/38P1JT4
  26. @christophrumpel NO SPEAKERS PROPERTY Base Eloquent Model Laravel Core Adventures

    https://laravelcoreadventures.com
  27. Code Examples Git repository with my code examples https://bit.ly/3ePkhXg

  28. None
  29. The End