Skip to content

Instantly share code, notes, and snippets.

@Demoli
Created October 28, 2012 21:20
Show Gist options
  • Save Demoli/3969965 to your computer and use it in GitHub Desktop.
Save Demoli/3969965 to your computer and use it in GitHub Desktop.
Example route config
'router' => array(
'routes' => array(
'login' => array(
'type' => 'Literal',
'options' => array(
// Change this to something specific to your module
'route' => '/login',
'defaults' => array(
// Change this value to reflect the namespace in which
// the controllers for your module are found
'__NAMESPACE__' => 'User\Controller',
'controller' => 'Auth',
'action' => 'index',
),
),
),
'oauth-login' => array(
'type' => 'Segment',
'options' => array(
'route' => '/opauth[/:strategy][/:callback]',
'defaults' => array(
'__NAMESPACE__' => 'User\Controller',
'controller' => 'Auth',
'action' => 'opauth',
),
),
),
'opauth_callback' => array(
'type' => 'Segment',
'options' => array(
'route' => '/opauth/response',
'defaults' => array(
'__NAMESPACE__' => 'User\Controller',
'controller' => 'Auth',
'action' => 'oauthcallback',
),
),
'child_routes' => array(
'query' => array(
'type' => 'Query',
),
)
),
'user' => array(
'type' => 'Literal',
'options' => array(
// Change this to something specific to your module
'route' => '/user',
'defaults' => array(
// Change this value to reflect the namespace in which
// the controllers for your module are found
'__NAMESPACE__' => 'User\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
// This route is a sane default when developing a module;
// as you solidify the routes for your module, however,
// you may want to remove it and replace it with more
// specific routes.
'default' => array(
'type' => '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(
),
),
),
'register' => array(
'type' => 'Segment',
'options' => array(
'route' => '/register[/:usertype]',
'defaults' => array(
'controller' => 'Index',
'action' => 'register',
'usertype' => 'user'
),
)),
'login' => array(
'type' => 'Literal',
'options' => array(
'route' => '/login',
'defaults' => array(
'controller' => 'Auth',
'action' => 'login',
),
)),
'edit' => array(
'type' => 'Literal',
'options' => array(
'route' => '/edit',
'defaults' => array(
'controller' => 'Index',
'action' => 'edit',
),
)),
'strategy' => array(
'type' => 'Segment',
'options' => array(
'route' => '/index/edit[/:strategy]',
'defaults' => array(
'controller' => 'Index',
'action' => 'edit',
),
),
),
'auth' => array(
'type' => 'Segment',
'options' => array(
'route' => '/auth',
'defaults' => array(
'controller' => 'Auth',
'action' => 'index',
),
),
),
'opauth' => array(
'type' => 'Segment',
'options' => array(
'route' => '/opauth[/:strategy][/:callback]',
'defaults' => array(
'controller' => 'Auth',
'action' => 'opauth',
),
),
),
'change-account' => array(
'type' => 'Literal',
'options' => array(
'route' => '/changeAccount',
'defaults' => array(
'controller' => 'Index',
'action' => 'changeAccount',
),
),
),
'upload-photo' => array(
'type' => 'Literal',
'options' => array(
'route' => '/uploadPhoto',
'defaults' => array(
'controller' => 'Index',
'action' => 'uploadPhoto',
),
),
),
'crop-image' => array(
'type' => 'Literal',
'options' => array(
'route' => '/cropImage',
'defaults' => array(
'controller' => 'Index',
'action' => 'cropImage',
),
),
),
'listing' => array(
'type' => 'Literal',
'options' => array(
'route' => '/listing',
'defaults' => array(
'controller' => 'Listing',
'action' => 'index',
),
'may_terminate' => true,
),
/*'child_routes' => array(
'query' => array(
'type' => 'Query',
),
)*/
),
),
),
)
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment