In Drupal 8 we can have placeholders in our path. In Drupal 7 these were either wildcard arguments and they were sometimes autoloaded. The process of autoloading placeholders is called upcasting and it's a bit more involved in Drupal 8 and will cover it at a later post.
Placeholders will be replaced with values provided in the url and will be passed as arguments to the controller method. The name of the placeholders and parameter names must match, this is important because if they don't an exception will be thrown.
Our controller method looks like this
Visiting whoami/John will display the following
If no value for the placeholder is provided in the URL it will result in a 404 error. If we want the path to still work and make the place holder optional you need to provide a default value for the placeholder in our .routing.yml
Now visting just '/whoami' will result in the following output