Backend and Infrastructure

Symfony Controllers

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

When it comes to rendering a page, the application compares the URL against the routes until one matches, Symfony reads the _controller key and executes that function. The page you want to render is built in the function. Controller functions are dead-simple, and there’s just one big rule: it must return a Symfony Response object. In this lesson, we'll build our Response, take a look at JSON, and then render the template using the Symfony templating service.