News Feed
Sections




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

SitePoint PHP Blog:
Understanding Symfony Bundle Configuration and Service Container
February 04, 2014 @ 10:46:03

The SitePoint PHP blog has a post today for those that may be new to the Symfony framework or just wanting to get into it and having trouble understanding bundle configuration. In this new post Carl Vuorinen walks you through this process, combining an example bundle with its configuration.

In this post we'll cover different ways on how to configure Bundles in Symfony2 and how the dependency injection container works with the configuration. The Bundle configuration and Symfony dependency injection container (also known as service container) can be difficult concepts to grasp when first starting development with Symfony2, especially if dependency injection is not a familiar concept beforehand. [...] I am used to working with YAML because I think it's more readable than XML, but you do get the benefit of schema validation when using XML.

He briefly introduces the concepts behind "bundles" in Symfony and two ways to create one - either via the generator on the command line or manually. He also shows two ways to get a bundle's configuration loaded. There's the "easy way", configuring it inside the main "confix.yml", or the slightly harder way of adding a configuration file inside the bundle structure itself and using the "get" method to grab the values manually. With the location(s) of the configuration defined, he gets into the contents of the file and its structure. Finally, he shows the complete example, an "ExampleBundle" with a "greet" method that accepts the configuration value from the "cvuorinen_example.greeter" setting.

0 comments voice your opinion now!
symfony bundle configuration container service tutorial introduction

Link: http://www.sitepoint.com/understanding-symfony-bundle-configuration-service-container

blog comments powered by Disqus

Similar Posts

MaltBlue.com: \Zend\Db\Sql - Creating Joins and Unions with Ease

SkyTechGeek.com: 10 Exceptional Tools For Website Testing

DevShed: Creating the Blog Script for a PHP/MySQL Blogging System (Part 2)

Gonzalo Ayuso: Managing Windows services with Symfony/Process and PHP

Noupe.com: Beautiful Forms - Design, Style, & make it work with PHP & Ajax


Community Events





Don't see your event here?
Let us know!


install community laravel api opinion unittest podcast series deployment voicesoftheelephpant library bugfix release framework introduction package zendserver symfony interview language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework