Using Grip with Zend Framework 2

If you’ve been following / contributing to Zend Framework 2 then you have most likely have read / seen Rob’s (@akrabatGetting started with Zend Framework 2.

Throughout the tutorial you use Zend’s Dependency Injection container to inject all the dependencies into each class. If you’re interested in using Grip’s powerful IoC container, I’ve included the gist of the changes needed to be made including the equivalency mapping of the objects the tutorial uses.

This assumes you have placed the framework under the vendor folder. You are free to place the context file where ever you feel like, but I would recommend keeping it in the top level config folder. Also, remember to change our the database credentials to match your settings in the context file.

You may delete all the “Di” mappings under ZendSkeletonApplication/module/Album/configs/module.config.php except for Zend\View\PhpRenderer as Zend requires this to figure out where to look for the views.

You’re ready to start taking advantage of Grip Inversion of Control container.

Comments are closed.