Dependency Injection in PHP | Create a Service Container from Scratch | Use PHP-DI

Опубликовано: 01 Март 2024
на канале: Dave Hollingworth
5,590
306

Learn what dependency injection is, and how to do it in PHP.
Please consider supporting my channel: ☕ https://ko-fi.com/davehollingworth

Topics covered:
• Dependency injection
• Service containers
• Autowiring
• Third-party DI containers like PHP-DI

All source code shown is free to download:
‣ https://gist.github.com/daveh/80901d2...

Links shown in the video:
‣ https://laravel.com/docs/10.x/container
‣ https://symfony.com/doc/current/compo...
‣ https://www.php.net/manual/en/reflect...
‣ https://php-di.org/

Videos:
‣ Securely Storing PHP Configuration Settings
   • Securely Storing PHP Configuration Se...  

Image used in thumbnail:
‣ https://www.freepik.com/icon/uml_9539813

00:00 Introduction
00:22 What is dependency injection?
03:46 Create a DI container
05:27 Autowiring
11:00 Defining services
13:52 Use PHP-DI
15:48 Summary

#PHP #dependencyinjection #laravel #symfony