Symfony2 and Twitter Bootstrap Symfony2 and Twitter Bootstrap symfony symfony

Symfony2 and Twitter Bootstrap


I'm pretty sure these Bundles are great, but they have advantages and drawbacks. You could also use TB without a Bundle directly in your project. That's what I personally do, that way:

  • git clone TB in web/ (to get latest updates and keep updated)
  • I directly call bootstrap.less in my twig templates with Assetic and the less filter. That way, I can create my own .less files that @imports TB and use their astonishing mixins for example.

It's really powerful this way. Coupled with yui-compressor, when I use Assetic in no-debug mode, all my js and less files are compiled into one single .css output and one single .js output. And you could benefit from all TB functionalities, in .less, not .css


There are 2 major bundles that provides symfony integration with Twitter Bootstrap:

In my opinion:

MopaBootstrapBundle is more complex, provides its own layout structure (of cause you can create your own too) and lot of defined functionality, extra assetic, forms and other integration

BcBootstrapBundle is more simple and much more clear you use your own layout structure and there is a lot of defined functionality, extra assetic, forms and other integration too

dont use any intergtaion bundle also is an option, but you loose integration with forms, assetic, less and so (as @Acyra mentioned in his comment)

I prefer to use BcBootstrapBundle with its extra integration functionality and use my own custom layout structure.


You can use Twitter Boostrap (TB) to only add css to your project. And then, you have a starting point to do something more visual than started from scratch. As you described in the first part.

But, you can also retrieve more interesting stuff from a Bundle which handle template integration with TB. For example:

For example, with symfony 1.4 (I know this post talks about sf2), you have a plugin that can add a new theme to the admin generator to have a nice TB integration instead of the default. I know there is no official admin generator in sf2 but it can be used for CRUD.

One other thing that can be true since symfony 1.0, not all bundles are very well implemented, developped, maintained, tested, documented, etc .. (except thoses from the core team (FOS* Bundle, Doctrine, Propel, etc ..)). So I recommend you to test them all, see if one of them fit your need, otherwise take inspiration to improve them (they are almost all on github) or build your own.

And btw, there are many Bundle ..