As a symfony developer and an Open Source fan, I would like to share the code source I produced for this weblog application. I left the source code in a Subversion repository hosted by Google Code. Feel free to checkout the code, to install the application and review the code I wrote. You will probably learn lots of good things and best practices. The content of this post explains how to install and run the application.
Introduction
You are about to install this symfony project. This is an Open Source application released under the MIT license that provides a weblog platform. The project is split in two applications: the frontend and the backend.
The frontend application is the interface dedicated to the public whereas the backend application hosts the weblog management.
Dependencies
This symfony project has several dependencies:
- PHP 5.2.4 or later
- Symfony 1.4.x framework
- sfDoctrineGuardPlugin
- sfFormExtraPlugin
- sfEasyMarkdownPlugin
- sfEasySyntaxHighlighterPlugin
Web Server Installation
To install this project, run the following command:
$ cd /path/to/web/root $ mkdir blog $ cd blog/ $ svn co http://symfony-blog.googlecode.com/svn/tags/RELEASE_0.9.0/ .
Create a virtual host in your httpd.conf or httpd-vhosts file:
<VirtualHost *:80> ServerName sf-blog.local DocumentRoot "/path/to/web/root/blog/web" <Directory "/path/to/web/root/blog/web"> AllowOverride All Allow from All </Directory> Alias /sf /path/to/web/root/blog/lib/vendor/symfony/data/web/sf <Directory "/path/to/web/root/blog/lib/vendor/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost>
Restart your Apache server and add the following entry to your hosts file:
127.0.0.1 sf-blog.local
Configure Databases
First, you will need to configure at least two database connections. The first one is dedicated to the development and production environments. The second will host the test environment.
Configure your database connections in config/databases.yml file. The code
below configures two MySQL connections.
test:
doctrine:
param:
dsn: mysql:host=localhost;dbname=blog_test
username: my_username
password: my_password
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql:host=localhost;dbname=blog
username: my_prod_user
password: secret
Configure the Frontend Application
Then, you will have to change some sensible defaults in the
apps/frontend/config/app.yml file as described below:
test:
bookmarks:
max_in_sidebar: 3
all:
available:
cultures: [en, fr] # Available Cultures
contact:
email: you@example.com # Contact email
feeds:
author: John DOE # Atom feeds author
email: you@example.com # Atom feeds email
posts:
max_per_page: 5 # Max posts per page
comments:
max_in_sidebar: 20 # Max comments in sidebar
bookmarks:
max_in_sidebar: 20 # Max bookmarks in sidebar
blogroll:
max_in_sidebar: 20 # Max blogroll links in sidebar
Update fixtures
Eventually, you can add more fixtures in data/fixtures/prod/*.yml files. The default administrator user is admin and password is secret. You can change this login and password in the data/fixtures/prod/sfGuardUser.yml file.
Build the Project
When your project is configured, run the following command to build everything:
$ cd /path/to/your/project $ php symfony doctrine:build --all --env=test $ php symfony doctrine:build --all --and-load="data/fixtures/prod/"
Run the Test Suite
To run the test suite, just execute the command below:
$ php symfony test:all
Deploy Web Assets
Run the following command to deploy plugins' assets:
$ php symfony plugin:publish-assets
Browse your Application
You can navigate the frontend application by browsing the following URIs:
http://sf-blog.local/frontend_dev.php
http://sf-blog.local/index.php
And the backend application with the following URIs:
http://sf-blog.local/backend_dev.php
http://sf-blog.local/backend.php



Posted by pomeh - about 1 month ago
J'ai déjà une petite question, mais qui à plus attrait au serveur. Est-ce que tu sais comment on peut configurer un projet symfony sur un serveur mutualisé ? On a pas forcément accès aux fichiers de configurations de apache... Et deuxième petite question, je viens de découvrir que tu utilise ServerGrove qui propose des solutions avec des framework php, est-ce que tu en est content ? Si tu devez en lister les principaux avantages/inconvénients, quels seraient-ils ?
Merci pour ces petites réponse et surtout merci pour ce partage :)
Posted by Hugo Hamon - about 1 month ago
Ca dépend des hébergeurs mais je sais que sur OVH par exemple la ligne de commande n'est pas disponible ce qui est plutôt problématique. Quand on travaille avec symfony, on doit s'assurer d'avoir un hébergement sur lequel on peut avoir la main. ServerGrove par exemple me fournit un hébergement mutualisé dédié à l'accueil de projets symfony. Je n'ai pas accès directement à la configuration d'Apache mais je dispose d'un backoffice Plesk pour tout administrer ainsi qu'un accès ssh suffisant pour exécuter des commandes symfony.
>> [...] ServerGrove qui propose des solutions avec des framework php, est-ce que tu en est content ?
Plutôt oui pour un service gratuit ^^ ServerGrove m'a offert un plan d'hébergement mutualisé donc je ne me plains pas sur la qualité. Il y'a eu quelques petits désagréments de leur côté lorsqu'ils ont migré mon compte sur un nouveau serveur avec PHP 5.3 mais ça a été très vite réglé car je suis en contact direct avec le CTO chez eux. Je ne suis jamais passé par leur service clientèle.
>> [...] principaux avantages/inconvénients, quels seraient-ils ?
+ Très bon rapport / qualité prix
+ Serveur en PHP 5.3 + MySQL + PostGreSQL + Python
+ Accès SSH pour administrer ses projets symfony
+ Panel de gestion Plesk pour gérer les domaines, les mails, les stats...
- Serveurs américains donc adresses IP américaines (pas très avantageux pour l'indexation sur Google.fr par exemple)
- Configuration de PHP pour les USAs (locale, date / heure ...)
Hugo.
Posted by Sylvain Papet - about 1 month ago
Il est possible d'avoir la console sous OVH mais il faut bidouiller, enfin je ne sais pas si c'est encore le cas car ça fait bien un an que j'ai plus de projets sur un mutu ovh. Avant en tout cas, taper php en console exécutait php4, il fallait donc chopper le path de php5 et lancé un truc du genre "/[path]/php5.2.8 -f symfony"
Posted by David - about 1 month ago
Posted by NiKo - about 1 month ago
C'est juste dommage d'avoir mis ça sur subversion, un ptit dépôt git(hub) te permettrait de recevoir des contributions plus efficacement amha :)
Posted by Hugo Hamon - about 1 month ago
Posted by Hugo Hamon - 23 days ago
Posted by Serhadrartida - about 7 hours ago
Thank You<a href=http://ukegfvkwuergfku.com>!</a>
Posted by Serhadrartida - about 3 hours ago
Thank You<a href=http://ukegfvkwuergfku.com>!</a>