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

Hyphens in URL's require expressive paths

I just updated my system from Phalcon 1.3.4 to Phalcon 2.0.13 and it appears that that it's no longer possible to have dashes in the route without manually rewriting every URL in the system.

I have a REST API which previously had this route:

$router->add('/:controller/:int', array("controller" => 1, "action" => "index", "id" => 2));

This solved all problems in my system, but in Phalcon 2.0, hyphens are no longer camelized and thus, all my URL's break.

I have been trying to find a solution to this, but none has worked because:

  • There's no way to use an overload of the \Phalcon\Text-class running the old implementation.
  • There's no way to expressively set a controller; only Actions can be overridden.
  • The convertmethod is no longer available.

Does this meant that I have to manually write all my URLs like:

$router->add("/power-of-attorney", array("controller" => "power_of_attorney"));

... or is there actually a solution to this?

Thank you.