Symfony\Component\Routing\Router::match PHP Method

match() public method

Returns false if no route matches the URL.
public match ( string $url ) : array | false
$url string URL to be parsed
return array | false An array of parameters or false if no route matches
    public function match($url)
    {
        return $this->getMatcher()->match($url);
    }

Usage Example

 /**
  * On kernel response event
  *
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     // Only master request and 200 OK are processed
     if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType() && $event->getResponse()->isOk()) {
         $route = $this->router->match($this->request->getPathInfo());
         // Ignore internal route
         if (0 === stripos($route['_route'], '_')) {
             return;
         }
         $this->session->set('_unifik.last_master_request_uri', $this->request->getUri());
         $this->session->set('_unifik.last_master_request_route', $route);
     }
 }
All Usage Examples Of Symfony\Component\Routing\Router::match