There are no commands defined in the "mezzio:middleware" namespace

I tried creating the middle-ware via:

$ composer mezzio:middleware:create "App\XClacksOverheadMiddleware"

I am facing the error:
There are no commands defined in the “mezzio:middleware” namespace.

Any helpful pointers, please.



composer mezzio middleware:create "App\XClacksOverheadMiddleware"

Without the “:” between “mezzio” and “middleware”.

Reference: CLI Tooling - mezzio - Laminas Docs

I tried without ‘:’ as well but didn’t help:

$ composer mezzio middleware:create "App\XClacksOverheadMiddleware"

Following worked:

$ vendor/bin/laminas mezzio:middleware:create "App\XClacksOverheadMiddleware"


If you use the skeleton application then the script with name mezzio is registered for Composer:

More informations to custom commands with Composer: