Guest User

Untitled

a guest
Jan 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.73 KB | None | 0 0
  1. <?php
  2.  
  3.     namespace Application;
  4.  
  5.     use Zend\Mvc\ModuleRouteListener;
  6.     use Zend\Mvc\MvcEvent;
  7.  
  8.     class Module
  9.     {
  10.  
  11.         public function getConfig()
  12.         {
  13.             return array(
  14.                 'router' => array(
  15.                     'routes' => array(
  16.                         //  Standard stuff
  17.                         'home' => array(
  18.                             'type' => 'Segment',
  19.                             'options' => array(
  20.                                 'route'    => '/',
  21.                                 'defaults' => array(
  22.                                     'controller' => 'Application\Controller\Index',
  23.                                     'action'     => 'index',
  24.                                 ),
  25.                             ),
  26.                         ),
  27.  
  28.                         //  Resful API, i.e. /api/1.0/Users.json/4
  29.                         'api' => array(
  30.                             'type'    => 'Segment',
  31.                             'options' => array(
  32.                                 'route'    => '/api/1.0',
  33.                             ),
  34.                             'may_terminate' => true,
  35.                             'child_routes' => array(
  36.                                 'default' => array(
  37.                                     'type'    => 'Segment',
  38.                                     'options' => array(
  39.                                         'route'    => '/:formatter/:controller[/:action]',
  40.                                         'constraints' => array(
  41.                                             'formatter' => '[a-zA-Z][a-zA-Z0-9_-]*',
  42.                                             'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
  43.                                             'id' => '[a-zA-Z0-9_-]*'
  44.                                         ),
  45.                                     ),
  46.                                 ),
  47.                             ),
  48.                         ),
  49.                     ),
  50.                 ),
  51.                 'service_manager' => array(
  52.                     'factories' => array(
  53.                         'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
  54.                     ),
  55.                 ),
  56.                 'translator' => array(
  57.                     'locale' => 'en_US',
  58.                     'translation_file_patterns' => array(
  59.                         array(
  60.                             'type'     => 'gettext',
  61.                             'base_dir' => __DIR__ . '/../language',
  62.                             'pattern'  => '%s.mo',
  63.                         ),
  64.                     ),
  65.                 ),
  66.                 'controllers' => array(
  67.                     'invokables' => array(
  68.                         'Application\Controller\Users' => 'Application\Controller\Users',
  69.                         'Application\Controller\Index' => 'Application\Controller\Index'
  70.                     ),
  71.                 ),
  72.                 'view_manager' => array(
  73.                     'display_not_found_reason' => true,
  74.                     'display_exceptions'       => true,
  75.                     'doctype'                  => 'HTML5',
  76.                     'not_found_template'       => 'error/404',
  77.                     'exception_template'       => 'error/index',
  78.                     'template_map' => array(
  79.                         'layout/layout'           => __DIR__ . '/view/layout/layout.phtml',
  80.                         'application/index/index' => __DIR__ . '/view/application/index/index.phtml',
  81.                         'error/404'               => __DIR__ . '/view/error/404.phtml',
  82.                         'error/index'             => __DIR__ . '/view/error/index.phtml',
  83.                     ),
  84.                     'template_path_stack' => array(
  85.                         __DIR__ . '/../view',
  86.                     ),
  87.                     'strategies' => array(
  88.                         'ViewJsonStrategy',
  89.                     ),
  90.                 ),
  91.             );
  92.  
  93.         }
  94.  
  95.         public function getAutoloaderConfig()
  96.         {
  97.             return array(
  98.                 'Zend\Loader\StandardAutoloader' => array(
  99.                     'namespaces' => array(
  100.                         __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
  101.                     ),
  102.                 ),
  103.             );
  104.         }
  105.     }
Add Comment
Please, Sign In to add comment