We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Micro Application Wildcard Routing

Im trying to port over a simple API from Slim and am having issues making routes that accept a variable amount of parameters. The number of parameters is unknown so I cannot hard code numerous different params. For example I have a route that can have numerous numbers of parameters:




In Slim the syntax is:


Is there a way to do this with Phalcon micro? I noticed that the whole path is dumped into $_GET['_url'], however I would prefer not to have to parse that on not found. Thanks

edited Jul '14

You can use the :params placeholder:


$app = new Phalcon\Mvc\Micro();

$app->get('/route/:params', function ($var1, $var2, $var3) {
    echo "<h1>Welcome $var1!</h1>";