Last updated November 25, 2015. Created on October 28, 2013.
Edited by phenaproxima, HongPong, sidharrell, nedjo. Log in to edit this page.

This routing system replaces the routing parts of hook_menu() in Drupal 7. The parts of hook_menu() that were used for creating menu entries, tabs, actions and contextual links are taken over by other subsystems.

Powered by Symfony

Drupal 8's routing system is heavily based on Symfony's. Drupal's routing system can do everything Symfony's can (and more), and both use the same syntax to define routes.

To learn the basics of Drupal 8's routing system, the Symfony Routing component's documentation is an excellent place to start. The documentation here does not go into every aspect of Symfony's routing system, so if you're stuck on something it's a good idea to check the Symfony documentation as well.


A route is a path which is defined for Drupal to return some sort of content on. For example, the default front page, '/node' is a route. When Drupal receives a request, it tries to match the requested path to a route it knows about. If the route is found, then the route's definition is used to return content. Otherwise, Drupal returns a 404.

Routes and controllers

Drupal's routing system works with the Symfony HTTP Kernel. However, you don't need to know very much about the Symfony HTTP Kernel to do basic route operations. This is how the components relate to each other:


The routing system is responsible for matching paths to controllers, and you define those relations in routes. You can pass on additional information to your controllers in the route. Access checking is integrated as well.

Parameters in routes

Drupal 8's routes may include placeholder elements which designate places where the URL contains dynamic values. In the controller method this value is available when a variable with the same name is used in the controller method. For example in example.routing.yml:
  path: 'example/{name}'
    _controller: '\Drupal\example\Controller\ExampleController::content'
    _permission: 'access content'

The {name} element in the URL is called a slug and is available as $name in the controller method. More on parameters in routes

Looking for support? Visit the forums, or join #drupal-support in IRC.