Day 23: Another Look at symfony
Today is the last stop of our trip to the wonderful world of symfony. During these twenty-three last days, you learned symfony by example: from the design patterns used by the framework, to the powerful built-in features. You are not a symfony master yet, but you have all the needed knowledge to start building your symfony applications with confidence.
As we wrap up the Jobeet tutorial, let's have another look at the framework. Forget Jobeet for an hour, and recall all the features you learned during this whole book.
The framework also provides tools to ease deployment.
The Model part of symfony can be done with the help of the Propel ORM. Based on the database description, it generates classes for objects, forms, and filters. Propel also generates the SQL statements used to create the tables in the database.
The database configuration can be done with a task or by editing a configuration file. Beside its configuration, it is also possible to inject initial data, thanks to fixture files. You can even make these files dynamic.
Propel objects can also be easily internationalized.
By default, the View layer of the MVC architecture uses plain PHP files as templates.
Admin modules allows you to built a fully functional application without coding anything.
To abstract the technical implementation of a website, symfony uses a routing sub-framework that generates pretty URLs. To make implementing web services even easier, symfony supports formats out of the box. You can also create your own formats.
The symfony framework makes it easy to have different configuration settings for different environments. An environment is a set of settings that allows different behaviors on the development or production servers. You can also create new environments.
The configuration files mostly use the YAML format.
Instead of using the default directory structure and organize your application files by layers, you can also organize them by feature, and bundle them in a plugin. Speaking of the default directory structure, you can also customize it according to your needs.
The symfony framework provides quite a few core objects that abstract recurrent needs in web projects: the request, the response, the user, the logging, the routing, the mailer, and the view cache manager.
The form framework also provides built-in security features.
As managing forms is one of the most tedious task for a web developer, symfony provides a form sub-framework. The form framework comes bundled with a lot of widgets and validators. One of the strength of the form sub-framework is that templates are very easily customizables.
If you use Propel, the form framework also makes it easy to generate forms and filters based on your models.
Internationalization and localization are supported by symfony, thanks to the ICU standard. The user culture determines the language and the country of the user. It can be defined by the user itself, or embedded in the URL.
Functional tests are written with the
sfFunctionalTest class, which uses a
browser simulator and allows symfony core
objects introspection through Testers.
Testers exist for the request object, the
response object, the user
current form object, the
cache layer and the
You can also run all tests together.
The symfony framework only provides the foundation for your web applications and
relies on plugins to add more features. In this
tutorial, we have talked about
A plugin must be activated after installation.
Plugins are the best way to contribute back to the symfony project.
The symfony CLI provides a lot of tasks, and the most useful have been discussed in this tutorial:
propel:build --all -and-load
You can also create your own tasks.
The symfony framework, as does any piece of software, has a learning curve. In the learning process, the first step is to learn from practical examples with a book like this one. The second step is to practice. Nothing will ever replace practicing.
That's what you can start doing today. Think about the simplest web project that still provides some value: a todo list manager, a simple blog, a time or currency converter, whatever... Choose one and start implementing it with the knowledge you have today. Use the task help messages to learn the different options, browse the code generated by symfony, use a text editor that has PHP auto-completion support like Eclipse, and refer to the reference guide to browse all the configuration provided by the framework.
Enjoy all the free material you have at your disposal to learn more about symfony.
Before you leave, I would like to talk about one last thing about symfony. The framework has a lot of great features and a lot of free documentation. But, one of the most valuable asset an Open-Source can have is its community. And symfony has one of the most amazing and active community around. If you start using symfony for your projects, consider joining the symfony community: