Your first page
Creating a Symfony application takes one command and a few seconds. You can use Composer or the Symfony CLI utility.
In Symfony, a page is a method of a plain PHP class called a controller. No mandatory base class, no code generation, no XML. This is the entire code of a working page.
The #[Route] attribute defines the URL of the page, right next to the code that handles it. When you visit /lucky/number, Symfony runs this method.
The method's job is to return a Response object with the contents of the page. HTML, JSON, a file download: everything is a response.
$ composer create-project symfony/skeleton my_project$ cd my_project/$ symfony server:start# [OK] Web server listening# https://127.0.0.1:8000<?phpnamespace App\Controller;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Attribute\Route;class LuckyController{ #[Route('/lucky/number')] public function number(): Response { $number = random_int(0, 100); return new Response("<h1>Lucky number: $number</h1>"); }}