Starting Symfony2

June 8, 2015

Symfony Distributions

Installing Symfony

With Installer

c:\> php -r "readfile('http://symfony.com/installer');" > symfony

# Windows
c:\> cd projects/
c:\projects\> php symfony new my_project_name

With Composer

composer create-project symfony/framework-standard-edition my_project_name

Checking Symfony Version

$ php app/console --version

Running the Symfony Application

$ php app/console server:run #start
$ php app/console server:stop #stop

$ php app/console cache:clear --env=prod --no-debug #prod environment

So for accessing dev http://localhost/app_dev.php/random/10

For accessing prod http://localhost/app.php/random/10

Updating symfony

$ php composer update

Checking Security Issues

$ php app/console security:check

Using Git

Simfony applications already contain a .gitignore file.

When using Composer to manage dependencies, it is recommended to ignore the entire vendor/ directory before committing its code to the repository.

When cloning from git we need to install the vendor files

$ composer install