Get the route name in a Symfony service [duplicate]
问题 This question already has answers here : Getting the route name inside a service in symfony (2 answers) Closed 2 years ago . Im try to get the name of the current route in a Symfony 4 service. routes.yaml test-route: path: /test controller: App\Controller\Test::test service class Myservice { private $u; public function __construct(Utilities $u){ $this->u = $u; $route = getRouteSomehow(); // should return "test-route" } } I found this piece of code to grab the route: $requestStack-