---
date: 2020-11-17
id: c25c1315-47c9-484e-ba03-59c44c720cb5
title: Route
---

# Description

[PHP Attributes](20201110100420-php_attributes) can be used to define
routing.

# Syntax

``` php
// BEFORE: annotations defined with Doctrine Annotations library
use Symfony\Component\Routing\Annotation\Route;

class SomeController
{
    /**
     * @Route("/path", name="action")
     */
    public function someAction()
    {
        // ...
    }
}
```

``` php
// AFTER: annotations defined with PHP 8 attributes
use Symfony\Component\Routing\Annotation\Route;

class SomeController
{
    #[Route('/path', name: 'action')]
    public function someAction()
    {
        // ...
    }
}
```