Named & optional route

Hey there.

Phalcon routing allows me to create named or optional params. I'd like to combine it into one route. Please tell me how to configure an optional named param.

For example: $group->add("/users/all", array("action" => "readAll"));

Let's say there are a few optional params like name, street, age. The goal is to get urls /users/all/name/michael or /users/all/streeet/something/age/30. I am thankful for every kind of help.

Thanks, M.



83.4k

How do you expect to receive those parameters in the action method?

A simple array should be enough.

array("param1" => "value1", "param2" => "value2");