Symfony 2 – Instalation and configuration

symfony training for developing web sites
Symfony 2 is one of the best frameworks I have ever seen. Incredibly fast ( may be even the fastest framework ever ), it offers exceptional features. The common conception is that when you have a framework with great functionality, your projects will be executed very slow, but Symfony 2 Framework busts that myth.

Symfony 2 is:

  1. Twice faster from “Solar 1.0.0” ( considered one of the fastest framework ).
  2. Twice and half faster than Symfony 1.4.2.
  3. Three times faster from Zend Framework 1.10.
  4. Four times faster than Lithium.
  5. Six times faster than CakePHP 1.2.6
  6. Sixty times faster than Flow3 ( Typo 3 CMS is working with this framework ).

Another advantage of Symfony 2 is that it’s using half of the memory used by Symfony 1 or Zend Framework.

Installing Symfony 2 is very easy and quick task. For a few minutes, everything is set up and ready for development. To install Symfony 2 you need first to download the framework from their website, unzip the package and copy the framework at your working folder, where you are developing the web projects. If you are using WAMP, the folder will be “www”, if you are with XAMPP, the folder will be “htdocs”. It will be helpful if you install GIT ( fast version control system ). This tool is very powerful and nice to have. To work with Symfony 2, GIT is definitely the right choice. We have to enter the directory:

cd /c/users/madal/downloads/

Symfony 2 web development commands

In this directory you will find the package and you can unzip it manually or using the GIT command:

tar zxvf Symfony_Standard_2.0.12.tgz

Symfony 2, programming commands

You have to move your framework to the working folder where your web projects are. You can do it manually or with GIT command again:

mv Symfony /c/xampp/htdocs/

Symfony 2, web development commands: mv Symfony /c/xampp/htdocs/

and now you have unzipped Symfony 2 Framework in your working folder. Then we enter in the framework with GIT command:

cd /c/xampp/htdocs/symfony

Symfony 2, web development commands: cd /c/xampp/htdocs/symfony

Once we enter Symfony 2 Framework we have to install “vendors” with GIT command:

php bin/vendors install

Symfony 2, web development commands: php bin/vendors install

We have to install all additional packages that Symfony 2 is using, needed for our project. It is good idea if we update the packages, because there might be a little difference and we can do that with GIT command:

php bin/vendors update

Symfony 2, programming commands: php bin/vendors update

After using these commands, everything should work fine! You can check it by typing in the address bar inv the browser: “localhost/Symfony/web/app_dev.php” and the project will show up!

Congratulations! You have installed Symfony 2 Framework and now you can start working on your web projects. This process takes about 5-10 min. The Simfony 2 installation is very easy and quick task. Now, the settings! In the middle of the screen on your browser with the Symfony 2 project you will see a green button “Configure”, click the button and it will take you to another page where you can set up your drivers, host, database, port, username and password for the database. When you do this, click “NEXT STEP” and Symfony 2 will generate code for security reasons of the web application. Symfony 2 has a great level of security. The founders of Symfony 2 do a lot of work on security and make the framework very powerful. In this case our applications are more secure and difficult to hack while they are online and working. This is a great benefit! Now, your project is completed! We have Symfony 2 with the proper database configuration ( which you create in the beginning ) and you can start developing your project.

When eventually everything works flawless you can run “version control” with the GIT command:

git init

Symfony 2, programming commands: git init

and then

git add .

Symfony 2, programming commands: git add .

Using this commands adds all the files. Then the GIT command is :

git commit –m ‘First Commit’

Symfony 2, programming commands: git commit –m ‘First Commit’

Finally, we have versions of our project and we can start our web development. If we make a mistake on the project, while we are developing, we can always go back and fix the mistake in the project with the previous version and etc. The creating of the versioning of our project helps clearing many issues and bugs and it is extremely useful. This tool helps us to do better web development.

Symfony 2 is not just a framework for developing large web applications. Symfony 2 is philosophy, community – working in harmony.

Symfony 2 is everything that you can expect from a framework: speed, flexibility, reusable components, innovation, we have implemented the best practices in programming.

On the video bellow you can see how our colleagues are installing Symfony 2. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *