PHP Container Review

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:04
  • 0:06
    What we just did is incredible.
  • 0:08
    Every service object we have, meaning every object
  • 0:13
    that does work, like BattleManager,
  • 0:15
    PDO, and ShipLoader, is created by the container class.
  • 0:19
    This is its only job.
  • 0:23
    The benefits are huge.
  • 0:26
    Here's one—imagine we need to give BattleManager
  • 0:29
    a few constructor arguments.
  • 0:31
    Once we've done that, the only code we need to touch
Loading ...

PHP Container Review


We've got a nice little app working now, using our service container well. Good work! In this final lesson for this series we're going to have a review of working with containers. We'll look at why this is such a good practice, discuss model classes versus service classes, and take a moment to acknowledge best practices versus the real world implementations you can end up with.

Log in or sign up to download companion files.
Additional resources: