I have a web site originally written as per the instructions in the Slim/3 user guide:
- Have settings and dependencies in a
- Pass the container as argument to
- Define route handlers as class references (
Foo::class . ':action')
- Get container in route handler constructor.
I’m struggling to migrate it all to Slim/4. For a start, it seems that containers are no longer mandatory. I installed Pimple but I couldn’t make it work due to not being PSR-11 compliant out of the box. I thought perhaps it’d be easier to just install another PSR-11 container and tried PHP-DI but things were berserk because this other library has an entirely different syntax and relies on a lot of automagic features (autowiring bit me on the foot almost instantly).
I think it’s time to stop and think and get back to design board.
What’s the Slim/4 way to handle application settings (paths, configuration flags…) and helper libraries (session, loggers, database, etc.) that makes sense and matches my current flow?