How to inject custom php classes into zend directory



hi. does anyone know how to insert custom php classes into zend framework 3 modular structure?!


The module system of ZF2, ZF3 and zend-expressive is very flexible and simple. A module can contain (almost) everything.
Look at the “In-Depth tutorial”, there will you find an example of a blog module. This module includes many “custom” classes.
I hope this will help or do you mean something else?


I have used some custom classes in my document and for the record I studied blog module, but I had to include the classes. i am wondering if there is a way to address the desired custom class like in the zend plugins.


May be you just need to define autoload rules in composer.json for your namespace?
Here is simple example:

"autoload": {
  "psr-4": {
    “AppNs\\ModuleNs\\”: "module/ModuleNs/src"
"autoload-dev": {
  "psr-4": {
    “AppNs\\ModuleNs\\”: [


Please see in the tutorial or in the comment from @merkushin, because the autoloading is done by Composer. (More background infos here:
That’s all!