I'm receiving the following error in a Zend Framework 3 Application:
Fatal error: Uncaught Zend\ModuleManager\Exception\RuntimeException: Module (Serve) could not be initialized.
I'm aware that there is some answers however none seem to point to zf3 and ive already scanned them without answer. I cannot seem to find an answer through research.
Is it possible that my application is not loading modules? I have modified the application config just a tad so it might just not be loading the module itself.
I have a folder structure:
- module
-Serve
-src
-Module.php
-Controller
-IndexController.php
-config
-module.config.php
-view
I have the module added to the modules array inside /config/application.config.php
.
Here is my module.config.php
namespace Serve;
return array(
'controllers' => array(
'invokables' => array(
'Serve\Controller\Index' => 'Serve\Controller\IndexController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'serve' => array(
'type' => 'segment',
'options' => array(
'route' => '/srv[/:action]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
),
'defaults' => array(
'controller' => 'Serve\Controller\Index',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
'strategies' => array(
'ViewJsonStrategy',
),
),
);
Here is my Serve\Module.php
file:
<?php
namespace Serve;
class Module
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
}
I have a bunch of business logic inside my Application\Module.php
however nothing that looks to disrupt loading modules.
I cannot seem to find an answer through research. What could be wrong here?