Back to course

Routing Basics

Symfony 0 to Hero: The Complete 2026 Guide

Routing in Symfony

Routes map a URL path to a PHP function (Controller).

In Symfony 2026, we use Attributes:

php #[Route('/hello', name: 'app_hello')] public function index(): Response { return new Response('Hello World!'); }

Attributes are metadata added directly to your code classes and methods.