[Libertyvasion] Building phpBB4 on Symfony 2
Session: Building phpBB4 on Symfony 2 by Fabien Potencier
Date/Time: Saturday 8/21 at 11:10 AM-12:10 PM
This post contains my rough crib-notes from this presentation at Libertyvasion 2010. The post has not been proof-read for spelling, grammar, or accuracy.
This presentation will be similar to yesterday’s presentation about Symfony 2, but not as much specific code demos. First, a quick look at Symfony 1 vs. Symfony 2.
Symfony’s goal is to allow developers to make better applications faster, and has been designed to be the best possible platform to create end-user websites and applications such as phpBB. Symfony uses an MVC (model-view-controller) framework. Symfony has a concept of a “slot” to defined content areas within the layout of your application. PHP can be used for templates, or an end-user templating engine can be used.
The Routing system in Symfony allows a single PHP file under the front-facing directory to be the front-controller, which provides for a much more user-friendly output of content. Showing an example of URL rewriting with this architecture.
Configuration in Symfony can be done using YAML, XML, or plain PHP formats.
The routing system means that templates never have to generate a URL, simply use the built-in routing methods to handle this process.
Bundles provides flexibility for the routing system — act somewhat like plugins, but Symfony bundles are treated like “first-class citizens.” Everything in Symfony is constructed as a bundle, structured as sets of files.
Environments allow for different modes/views depending on what process of the site development you’re in (i.e. Development Environment, Staging Environment, and Production Environment). You can also create your own custom environments.
Symfony provides Developer Tools to help debug problems faster. This includes a logging mechanism, the developer toolbar, etc.
Security is really important for Symfony (and phpBB), and processes are built-in to protect from XSS, CSRF, and SQL injections using built-in automatic escaping, if you ask for it in the code. Symfony 2 allows for creating an Apache environment variable in a .htaccess or httpd.conf file, which can be accessed in the database configuration file, helping to keep the information in different places for improved security.
Symfony uses PHPUnit for unit testing (like phpBB), and also provides functional tests to allow for testing your application.
Caching in Symfony is rather unique — Symfony actually relies on HTTP caching rather than provide its own system. ESI (Edge Side Includes) is a specification from 2001 implemented partially in Symfony 2.
Last but not least: HttpKernel is the construction kit for the framework and provides a lot of the architecture and building blocks used to create Symfony’s MVC framework. It’s a basic interface with a single handle() method, which can be used to build a framework compatible with Symfony 2. Going a step further by extending the interface provides a lot more power, including features such as the caching, the web developer toolbar, etc. This relies on an event system to roll through the model-view-controller architecture.
Stefan Koopmanschap is going to talk a bit about the Symfony community and how you can ask questions & get answers about Symfony, knowing that there will be many questions about it as phpBB starts integrating it.
* #symfony IRC channel on freenode (very friendly for new people, but be clear in what you’re looking for!)
* Symfony forums (which happen to be powered by phpBB)
* Symfony Google groups, the most important is the symfony-users group
* Ask a question about Symfony on Twitter (if you can get your question in 140 characters!)
* Symfony is probably the best-documented PHP framework right now
Q&A
Question to Nils: phpBB decided to start using a framework in order to not have to reinvent the wheel. Allows the development team to focus on actually building the application rather than the underlying framework.
Why Symfony? A few very technical reasons. phpBB4 wanted to be very future-proof, with a framework that’s not based at all on PHP4 code and was really something new. “If that’s one of your points, then there’s not a whole lot of frameworks left.” A couple of other ideas for phpBB4, some of which are listed on the Development Wiki, meant that the Dev Team decided to choose Symfony 2.
The benefits here are primarily for developers and MOD authors. MOD authors will see lots of differences because of the improved focus on modularity and extendability. phpBB4 seeks to eliminate having to modify core code, with a true plugin-style architecture that avoids changing lines of core code and prevents MOD conflicts. Also other bundles, not directly related to phpBB (i.e. the Blog MOD) can benefit from much tighter integration with phpBB without having to write them specifically for phpBB.
No Comments
RSS feed for comments on this post.





