symfony2 Getting started with symfony2 Installation or Setup


Symfony Framework - built with symfony components, is one of the leading PHP framework used to create robust websites and web applications.

Symfony can be installed quickly through two recommended ways.

  1. The official documentaion recommends to install the framework through the Symfony Installer which is a tiny php application that is installed once on the local system that helps in downloading the framework and setting up the configuration of the framework. Symfony Installer requires PHP 5.4 or higher. To install on legacy php version use Composer.
  2. Through the PHP dependency manager Composer

Installing through Symfony Installer

On Linux/Mac OS X run the following commands:

$ sudo curl -LsS -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony

On Windows move to the project directory and run the following command:

php -r "file_put_contents('symfony', file_get_contents(''));"

symfony project can be created by running symfony new my_project [2.8] on Linux/Mac OS X

On Windows php symfony new my_project [2.8]

or alternatively symfony new my_project lts will use the latest long-term support version of Symfony.

Installation through Composer

  • Download Composer

  • Use Composer's create-project command to download Symfony

    composer create-project symfony/framework-standard-edition my_project_name ["2.8.*"]

Excellent detailed official documentation here

Running the Symfony application

For starting symfony internal web server (available since PHP 5.4), go to the project directory and execute this command:

for symfony<=2.8

php app/console server:start

and for symfony >=3.0

php bin/console server:start

This starts the web server at localhost:8000 in the background that serves your Symfony application. Then, open your browser and access the http://localhost:8000/ URL to see the Symfony welcome page:

enter image description here