Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Replacing Pimple in a Slim 3 application
Jul 14, 2015 @ 15:56:00

Rob Allen has a quick post to his site showing you how to replace the default Slim dependency injection container (Pimple) with another option.

One feature of Slim 3 is that the DI container is loosely coupled to the core framework. This is done in two ways: The App composes the container instance rather than extending from it and internally, App depends on the container implementing the container-interop interface. [...] Slim 3 ships with Pimple by default, but my preference is for ZendServiceManager, so I decided to integrate ServiceManager into Slim 3.

While he's packaged it up into an installable library, he also walks through the process. He shows how it was implemented via a callback resolver in the ServiceManager. He had a little issue with the "set" functionality but solved it with a few simple "if" checks on the content type before setting it to the container.

tagged: replace pimple application slim3 servicemanager zend tutorial zsmslimcontainer

Link: http://akrabat.com/replacing-pimple-in-a-slim-3-application/


Trending Topics: