Controllers/Actions in Slim 3 + Auto-resolved dependencies


#1

I wrote an article on Medium about how I manage dependencies required by controllers/actions. The main points are:

  1. I don’t need to register all my actions/controllers to the container.
  2. I don’t need to remember my dependencies order when injecting through constructor
  3. The dependencies are served from the app container under the hood by extending (read: improve) the default CallableResolver class.
  4. It’s actually utilizing \ReflectionClass and seems very easy to understand

I really want to hear the feedback from you. Thanks in advance!


#2

If I remember correctly you can do all of this with the PHP-DI-BRIDGE and not have to do any of that.


#3

Thanks @geggleto for providing me the link to that. But, does that project require us to use at least PHP 5.6? Unfortunately, I’m running on a 5.5 shared hosting :neutral_face: so yeah…


#4

you might want to remind your employeers that 5.5 is now EOL and will no longer receive security updates.