私はこれをDI構成の一部として、スケルトンアプリケーションから取得しています。
'routes' => array(
'default' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'Application\Controller\IndexController',
'action' => 'index',
),
),
),
次のルーティングを行いたいと思います。
http://me.com/mycontroller/myaction -->
controller=Applicaiton\Controller\Mycontroller
method=myactionAction
ただし、上記の構成では次のようになります。
http://me.com/mycontroller/myaction -->
controller=Mycontroller
method=myactionAction
ご覧のとおり、コントローラーの名前空間がありません。名前空間をどこに/どのように配置しますか?(すべてのコントローラーに対してDIエイリアスを作成できることはわかっていますが、それではセグメントマッチングの目的が無効になります。)