I have this configuration in a multi-module application:
$router->add('[/]?{module:[a-zA-Z0-9_-]*}[/]?{controller:[a-zA-Z0-9_-]*}[/]?{action:[a-zA-Z0-9_-]*}[/]?{params:(/.*)*}', array(
'module' => 1,
'controller' => 2,
'action' => 3,
'params' => 4
));
$router->add('/', array(
'module' => 'frontend',
'controller' => 'index',
'action' => 'index'
));
$router->notFound(array(
'module' => 'frontend',
'controller' => 'Error',
'action' => 'route404'
));
Can also be made dynamic generation of namespaces? For example:
"namespace" => "Apps \ 1 \ Controllers"
"namespace" => "Apps \: module \ Controllers"