Introduction to Symfony
Prerequisites: Introduction to Laravel
Symfony is PHP's other major framework — more modular than Laravel (you can use individual Symfony components without the whole framework), and the foundation several other tools (including parts of Laravel itself) are built on.
#[Route('/users/{id}', methods: ['GET'])]
public function show(int $id, UserRepository $users): Response
{
$user = $users->find($id);
return $this->json($user);
}
Note the attribute (#[Route(...)], from earlier in this
level) used directly for routing — a defining stylistic difference
from Laravel's separate routes/web.php file. Choosing between
them mostly comes down to team preference and existing codebase
conventions; both are production-proven at scale.