Same Route to multiple Namespaces

Hi, I have the namespace Icon\Controllers and Icon\Net\Controllers

I'm using $loader->registerNamespaces to register both namespaces and setting $dispatcher->setDefaultNamespace("Icon\Controllers"); but I don't know how to make Icon\Net\Controllers accessible

The controllers from Icon\Controllers are accessible through http://localhost/Controller_Name

I wanted to make \Icon\Net\Controllers accessible through http://localhost/Controller_Name as well.

I already tried making it work using routes, by adding these two routes, but they didn't work:

$router->add('/:controller', array(
        'controller' => 1
));

$router->add('/:controller', array(
        'namespace' => 'Icon\\Net\\Controllers',
        'controller' => 1
));


1.6k

How should the router know if it should load the controller from Icon\Controllers or \Icon\Net\Controllers? Either place the controllers in the same namespace or use modules to use controllers from different packages.

Is there any way to have the same namespace divided into several folders?