When adding a new module manually in Zend 3 platform, you basically add files within a defined folder structure of your own (you can just copy a skeleton application and rename the directory). See the tutorial on Zend 3 project for more details.
Once you have added the files you will generally meet a few errors if you just hit the refresh button of your browser.
PHP Fatal error: Uncaught Zend\ModuleManager\Exception\RuntimeException: Module could not be initialized in … ModuleManager
So make sure you do the following steps
Inside the config directory of your project :
return [ 'Zend\Router', 'Zend\Validator', 'Zend\Session', 'Zend\Cache', 'Zend\Paginator', 'Zend\I18n', 'Zend\InputFilter', 'Zend\Filter', 'Zend\Hydrator', 'Zend\Mvc\Plugin\Prg', 'Zend\Mvc\Plugin\Identity', 'Zend\Mvc\Plugin\FlashMessenger', 'Zend\Mvc\Plugin\FilePrg', 'Zend\Form', // Add the Doctrine integration modules. 'DoctrineModule', 'DoctrineORMModule', 'DoctrineDataFixtureModule', 'Application', 'MyModule' ];
And to make sure everything is running fine on the configuration side, add this at the root of your project inside composer.json file :
"autoload" : { "autoload" : { "psr-4" : { "Application\\" : "module/Application/src/", "MyModule\\" : "module/MyModule/src/" } },
Beware when using an IDE such as Eclipse or NetBeans or any others, when you change the composer.json file using the default editor, it might not overwrite the true file and you will end up with the Runtime Exception. So do modify your file content using a text editor :
Run composer update
One more last step and you will be done :
$ composer update
If you are having other issues, you should check the right paths which you have set up in your module.config.php file.
Stay tune for more typical Zf3 integration errors, we will add them here so we can keep track on them and have a quick fix when we encounter them again. For instance we will try to add this entry right inside our code in another project.
Saved my day. Thanks.