Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
This course is archived!

A Container in your Project

Video not working?

It looks like your browser may not support the H264 codec. If you're using Linux, try a different browser or try installing the gstreamer0.10-ffmpeg gstreamer0.10-plugins-good packages.

Thanks! This saves us from needing to use Flash or encode videos in multiple formats. And that let's us get back to making more videos :). But as always, please feel free to message us.

Ok, time to get to emailing! No matter what framework or system you work on, you can start applying these principles immediately. You may already have a dependency injection container available to you, and if so, great! If not, don't worry! Even without a container, you can start applying the principles of moving code into new service classes and using dependency injection. If you have to instantiate these service objects manually when you need them, that's still a huge step forward!

You can also bring a container into your project. Pimple is the simplest and easiest, but there are also others such as Symfony's DependencyInjection Component, Aura Di, and Zend\Di. These are more feature-rich and also contain speed optimizations.

Somewhere early in your bootstrap process, simply create the container, configure it, and make it available to your controllers or page code.

If you have any questions or comments, post them! Have fun, and we'll see you next time!

Leave a comment!

Login or Register to join the conversation
Default user avatar

nicely explained

Cat in space

"Houston: no signs of life"
Start the conversation!