We will create a new PHP project with the Symfony2 framework support. After the project directory structure is created by the IDE, we will configure our Symfony2 website. So let's go through the following steps:
1. Create a brand new PHP project in the usual way, and in the step where you are asked to choose PHP Frameworks, check the Symfony2 PHP Web Framework checkbox, as shown in the following screenshot:
2. As soon as you click on Finish in the New Project Creation dialog box, the IDE generates a new Symfony project and dumps the extracted framework inside. The created project directory may look similar to the following:
3. Now, point your browser to
http://localhost/symfony2/web/config.php
(replacesymfony2
with your project directory name). The new, Symfony2 project configuration page will look similar to the following screenshot:You should see a welcome message from Symfony and maybe a list of problems detected by it. Try to resolve any major environment problems listed under the Recommendations section before continuing.
4. The Symfony framework provides a website configuration wizard. To enter the wizard, visit the Configure your Symfony Application online link, and configure your database credentials for the application. At this page, you may choose your database driver
(MySQL - PDO)
, update your database information, such as hostname, database name, username, and password, and proceed to the next step.You may choose the Bypass configuration and go to the Welcome page link if you have already configured the application.
5. In the next step, you may generate and update a global secret code (random alphanumeric string) for your web application. This secret code is used for security purposes, such as CSRF protection.
6. The final step shows a successful configuration message, such as Your distribution is configured! Actually, such a configuration has overwritten the
parameters.ini
file inside the/app/config/
directory.7. Now, point your browser to
http://localhost/symfony2/web/app_dev.php/
(replacesymfony2
with your project directory name). The new Symfony2 project landing page will look similar to the following screenshot:
We have successfully created and configured a new Symfony project along with demo applications. The fundamental directory structure of a Symfony2 project is described below:
Note
Getting started with Symfony at:
http://symfony.com/get_started
Understanding Symfony directory structure:
http://symfony.com/doc/current/quick_tour/the_architecture.html