~/talk

Dependency Injection for Mere Humans

Talkat PHP UK Conference 2023 · 2023-02-14..02-16· [php]
slides:none on file

Distinguishes service locator from dependency injection, proves DI by refactoring an order processor: extracts four concrete dependencies (repository, logger, time, mailer), converts static mailer to an injected instance, moves current time from constructor to method parameter and uses a null logger pattern; demonstrates Constructor injection, parameter injection and lazy wiring with a PSR-11 container (Pimple and a 140/280-character toy container), warns against using the container as a service locator.

AI-written summary · about

  1. 0:00Dependency Injection intro
  2. 1:08Why DI matters
  3. 4:46Class-level dependencies
  4. 10:24Obscure dependencies
  5. 13:55Refactoring to dependency injection
  6. 15:21Constructor injection
  7. 18:57Setter injection options
  8. 25:24Optional dependencies
  9. 27:11Parameter injection
  10. 31:01Dependency inversion
  11. 38:06Refactoring step-by-step
  12. 42:47How DI containers work
  13. 49:29PSR-11 container
  14. 51:14FizzBuzz container example
  15. 53:45Pimple in Slim
  16. 56:18Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.