How To Think About HTTP Middleware
HTTP middleware is a user interface decoration system, where the user interface is the HTTP request (input) and HTTP response (output).
HTTP middleware is not for your Domain work. The middleware is a path in to, and out of, the core Domain.
Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving you codebase, all while keeping it running the whole time.