May 4, 2015

Explore Symfony project structure

This summary is not available. Please click here to view the post.

PHP Symfony framework

Introduction


Symfony is a PHP web application framework for MVC applications.Symfony aims to speed up the creation and maintenance of web applications and to replace repetitive coding tasks.

Setup Symfony

First you need to download the symfony installer, use follwing command

Installation on Linux and Mac OS X

$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony

Installation on Windows
(Check whater the php.exe in your path variable)

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

Then create the project using symfony installer like this.

php symfony new projectName

Or you can create project using composer. Composer is a dependency manager. So it is better to use compasser. When you create project using composer you don't need the symfony installer. i recommend you to use composer.So you need to download the composer from this link and follow the instruction for installing composer from the given link.

After insatll the composer you can create project like this(Before do this go the prefered location for the project creation)

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

This will get little bit time for create the project. Because this command download the required files from the internet. After it compleate you will get this kind of file hierarchy.
What are these folders ?  :/
app/
    The application configuration, templates and translations.
src/
    The project's PHP code.
vendor/
    The third-party dependencies.
web/
    The web root directory.

Don't think much about these things i'll describe these things later. ok Now test the our created project. ok go to the created project folder from the terminal. The do this.

php app/console server:run

Then you will get the server address and go to the link from the browser. Then you can see the symfony welcome screen.