zend-frameworkmiddlewaremezzio

Mezzio => Service not registered


I have created a new module named ModuleA, which contains a middleware named MiddlewareA. I also have created a route (e.g. "login") which has MiddlewareA in its pipeline.

When I send a request to the path "login", get response which states that

Service MiddlewareA not registered

What is the solution to this problem?


Solution

  • Please check if you have added the new module to the composer.json file of the project, like:

    "autoload": {
        "psr-4": {
            "App\\": "src/App/src/",
            "ModuleA\\": "src/ModuleA/src/"
        }
    },
    

    After that please run this command on the project route:

    composer dump-autoload
    

    Please proceed these steps every time you create a new Module.