FrakyDale
FrakyDale

Reputation: 727

PHP Slim 2.X router call match method

PHPSlim version: 2.4.3

I would like to match an string against php slim router to know to which route it matches. ¿Is that possible? I couldn't find any "match" method exposed.

Example:

<?php

$match = $router->match("/party/create");

Upvotes: 1

Views: 119

Answers (1)

pau.moreno
pau.moreno

Reputation: 4675

Slim already has a method for this:

$this->app->router()->getMatchedRoutes($httpMethod, $url);

More information: https://github.com/slimphp/Slim/blob/2.x/Slim/Router.php#L104

Upvotes: 1

Related Questions