In this video we will take an introductory look at what a Symfony Service is, and how we can use Services inside our Symfony applications.

We'll start with discussing what a Service is with regards to Symfony, and then we will move on to actually coding our very first Service. It's surprisingly simple and straightforward, another classic case of scary sounding Symfony stuff, and you'll be an expert in creating and using your own Services in no time.

We're going to be using the new Symfony Best Practices bundle structure for this one, so if you're unsure what that's all about then do check out the link. Essentially it means our Service itself will live in the src/AppBundle folder, whereas the Service definition (the thing Symfony uses to 'know' about our Service) will live in the app/config/services.yml file.

We'll finish up this introduction to Symfony Services by using Dependency Injection to inject a parameter from the parameters.yml file. This sounds scary and complicated, but as you'll see in the video, it's a piece of cake.

And with that done, you'll have gained an understanding of what Symfony Services are and how we can use them in our projects.

Share This Episode

If you have found this video helpful, please consider sharing. I really appreciate it.

Episodes in this series

# Title Duration
1 Symfony Services 101 06:27
2 Symfony Services and Dependency Injection 05:13
3 Symfony Services in the Real World 09:49
4 Dependency Injection and Symfony Services (Updated for 3.3) 08:33