I want that when I call myapp's url like http://myapp/v1/admin
and http://myapp/v2/admin
then I want to setup like that module1/Admin
and module2/Admin
so moudlewise versioning can be done.
As I have seen this https://github.com/zfcampus/zf-versioning.Is this applicable for above scenario or please help me out to get right way. Thanks
Define routes in respective module.config.php
files.
module1
'router' => array(
'routes' => array(
'v1_admin' => array(
'type' => 'segment',
'options' => array(
'route' => '/v1/admin[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]*',
),
'defaults' => array(
'controller' => 'Module1\Controller\Admin',
'action' => 'index',
),
),
),
),
),
module2
'router' => array(
'routes' => array(
'v2_admin' => array(
'type' => 'segment',
'options' => array(
'route' => '/v2/admin[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]*',
),
'defaults' => array(
'controller' => 'Module2\Controller\Admin',
'action' => 'index',
),
),
),
),
),