Looking for Best Practices for Structuring Slim 4 Apps with Middleware and Route Groups?

Hi all,

I am currently working on a mid-sized API using Slim 4 and wanted to get some input on how others are organizing their projects — especially regarding middleware and route groups.

Right now, I have global middleware set in AppFactory, and I am grouping routes by resource (e.g., /users, /posts, etc.). However.., as the project grows, I am unsure if I should be breaking things down more granularly — maybe using custom middleware within route groups or splitting controllers further: ??

Are there any recommended practices or community-adopted patterns for keeping things clean and scalable in Slim 4: ?? Also, how are you handling dependencies and container bindings in larger apps: ??

I have checked the docs and examples.., but would really appreciate some real-world insight from those who have built production apps with Slim. I have also gone through this thread https://discourse.slimframework.com/t/models-middleware-philosophy-architecture-sap-fico-course-in-pune but still need more help.

Thanks in advance for any tips, suggestions, or resources !!

With Regards,
Marcelo Salas