Slim 3 and “fix” the middleware processing
Slim 3 is more or less in maintenance mode as we prepare for version 4.
Version 4 is actively in development which includes many optimizations to Error Handling and Middleware Execution.
Seems a bit slip-shod to view error responses as unimportant “edge cases”.
With proper unit/integration/acceptance testing these outcomes become incredibly small. For example the production environment for a rather popular app (50k requests/hr) receives <0.01% Error Rate. The Errors are caused by either: Bad Actors attempting to probe the system, or Robot/Scrapers misbehaving. Both cases I do not care and/or wish to encourage. This application runs through a fairly non-trivial stack; and we don’t log anything in our Application Layer; Simply sniff response codes the Application produces.
This is of course the solution that I use in my day job; This isn’t the only solution; There are an infinite number of ways to do things.
However for 99.9% of our Users; I would say that the cookbook article is a good reference on how to quickly implement CORS which is all it was written for but we always appreciate other viewpoints and would welcome a PR to update that page. The website documentation is generated from our Slim-Website repository on GitHub; Feel free to create a PR against the CORS cookbook page with any additional information that you think would be valuable.