Symfony Compiler Pass Example

In these two videos we are going to take an example of a problem I have seen in numerous projects, and learn how to refactor it towards a nicer implementation.

The starting point for our problem will be in an ever expanding if / else block that spills business logic into our controller code.

There are two approaches we will take, starting with a simpler, easy to understand and generally useful method.

Following this we will look at a way to use a Symfony Compiler Pass to configure our code in a more modular, and robust manner. The downside to this approach is that it is harder for developers who are new to Symfony to understand - at least until they are shown :)

In my opinion both of these approaches have their uses, and neither is the defacto solution every single time. You need to use your best judgement as ever.

This course is aimed at beginners through intermediate developers, and by the end of this short course you will have learned how to use a Symfony Compiler Pass to solve a real world problem.


# Title Duration
1 Extract, Extract, Extract 10:09
2 Introducing The Compiler Pass 13:03

Code For This Course

Get the code for this course.

Share This Course

If you have found this course helpful, please share it.

Presented by

Christopher Moss

Christopher Moss

Hi, I'm Chris and welcome to In this video you will learn about... :)