Expecting everyone to push updates to Github is just a roadblock. PHP website has been running for over 15 years with very useful information contirbuted by the users within the comment area.
An item so trivial as this,
https://forum.phalcon.io/discussion/3208/partial-uri-routing
could have been put as a comment and stored forever within this page's elements (this page has 100 things going on and can be daunting)
https://docs.phalcon.io/en/latest/reference/routing.html
It would forever be refernced and perhaps much clearer for those entering the framework.
Anyway, random loop I wrote so I don't have to add a new route everytime I create a new feature on my site.
But this will be lost in the forum for no one to read but a couple of people.
$uri_info = parse_url($_SERVER['REQUEST_URI']);
$trimmed_url = ltrim($uri_info['path'], $di->get("url")->getBaseUri());
$trimmed_url = rtrim($trimmed_url, "/");
if(trim($trimmed_url) <> ""){
$url_parts = explode("/",$trimmed_url);
if(count($url_parts) == 1)
{
if (class_exists(ucwords(strtolower($url_parts[0]))."Controller")) {
$router->add("/".strtolower($url_parts[0])."/",array("controller" => strtolower($url_parts[0]),"action" => "index"));
$router->add("/".strtolower($url_parts[0]),array("controller" => strtolower($url_parts[0]),"action" => "index"));
}
} else {
if(method_exists(ucwords(strtolower($url_parts[0]))."Controller", ucwords(strtolower($url_parts[1]))."Action")){
$router->add("/".strtolower($url_parts[0])."/",array("controller" => strtolower($url_parts[0]),"action" => strtolower($url_parts[1])));
$router->add("/".strtolower($url_parts[0]),array("controller" => strtolower($url_parts[0]),"action" => strtolower($url_parts[1])));
if(count($url_parts) > 2){
$param_string = "";
for ($i = 1; $i <= count($url_parts); $i++) {
$param_string .= "/{param".$i.":[a-zA-Z0-9_-]+}.*";
$router->add("/".strtolower($url_parts[0])."/([a-zA-Z0-9_-]+)".$param_string,array("controller" => strtolower($url_parts[0]),"action" => 1));
}
}
} else {
if (class_exists(ucwords(strtolower($url_parts[0]))."Controller")) {
$param_string = "";
for ($i = 1; $i <= count($url_parts); $i++) {
$param_string .= "/{param".$i.":[a-zA-Z0-9_-]+}.*";
$router->add("/".strtolower($url_parts[0]).$param_string,array("controller" => strtolower($url_parts[0]),"index" => "here"));
}
}
}
}
}