PHP Service Container

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
    Good news.
  • 0:06
    We've got great flexibility.
  • 0:09
    Bad news— we have to create
  • 0:11
    the service objects by hand and the stuff that's duplicated.
  • 0:16
    We need to centralize what we've got here.
  • 0:18
    To do that, we'll create one special class
  • 0:21
    whose only job is to create these service objects.
  • 0:25
    This class is called a service container—
  • 0:27
    you know, because it's basically a container
  • 0:30
    for all the service objects. You'll see.
Loading ...

PHP Service Container

Loading...

So far we have to create our service objects by hand and this stuff is duplicated. We need to centralize our service objects to make our lives easier. To do that, in this tutorial we'll create one special class whose only job is to create these service objects. This class is called a service container because, well, it's basically a container for all the service objects. We're going to create our service container and then update our code to use it properly.

Downloads: 
Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.