We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon URL Params

Generate a URL with GET arguments (/show/products?id=1&name=Carrots)

echo $url->get("show/products", ["id" => 1,"name" => "Carrots",]);

In the documentation i did not find anything about pass an array [$param1,$param2] that match with a Action. Has some way to do it withou extend the interface?

I think can has a flag or if the key isnt numeric

! count(array_filter(array_keys($args), 'is_string')) > 0

Has some way to it be a native component or some flag to modify the behavior. Maybe another method

$url->getWithParams('/url',[$param1,$param2....]);

matchs Show::Products($param1,$param2)

To be clear i already did it based on numeric keys presence, but if could do native i think will be better and fast.

If the router does no know of the params it will not accept or pass them through to the controller. To be clear, you can not add queries via the router. Use the path parameters

example

$router->addGet('show/products/{id:[0-9]+}/{name}', 'Products::show');

the your $url->get() will work as it knows the router and the parameters