Parameters in routes

The routing system allows supplying dynamic values as parameters to the controller, mostly through upcasting. Read more about using parameters in routes.

Using parameters in routes

Parameters can be used to pass dynamic values from the URI to the controller.

Parameter upcasting in routes

Routes in Drupal 8 may include placeholder elements which designate places where the URL contains dynamic values.

Accessing raw parameter values

If you need to access the unconverted data, like for example a user ID, you can access the data using $request->attributes->get('_raw

Validate route parameters

Drupal 8's routes placeholder values (i.e., parameters passed in the URL) may be validated using the routing system.

How upcasting parameters works

Read how, for example, a node ID actually gets converted into the actual node object.

Implementing custom parameter converters

It should be very rare that you need custom parameter converters, because all content and configuration entities automatically get upcast,

Guide maintainers

Pancho's picture