How to get the name of the executable in PHP framework Slim v3. *?

Tried through \Slim\Router . I did not find suitable methods. Thank.

    1 answer 1

    This should probably help you.

    • I can not get a copy of this \Slim\Route . - Igor
    • one
      If you have $ request you can try this: $routeInfo = $request->getAttribute('routeInfo'); $router = $this->container->get('router'); $route = $router->lookupRoute($routeInfo[1]); $name = $route->getName(); $routeInfo = $request->getAttribute('routeInfo'); $router = $this->container->get('router'); $route = $router->lookupRoute($routeInfo[1]); $name = $route->getName(); - Powar
    • I faced the problem that in Middleware I could not get the name of the route that matches the incoming url. The matter was solved by setting the determineRouteBeforeAppMiddleware key to true in the settings when the application was started. Then, before launching the application, Middleware searches for a route that matches the url and can be obtained in the way that you described. - Igor