Installation and Configuration os Symfony2 on Windows 7


1. What is Symfony?

Symfony is an open source PHP web development framework designed to optimize the development of web applications by way of several key features. For starters, it separates a web application’s business rules, server logic, and presentation views. It contains numerous tools and classes aimed at shortening the development time of a complex web application, but also for smaller functionalities needed for your project. Additionally, it automates common tasks so that the developer can focus entirely on the specifics of an application. The end result of these advantages means there is no need to reinvent the wheel every time a new web application is built.
Symfony was written entirely in PHP 5. It has been thoroughly tested in various real-world projects, and is actually in use for high-demand e-business websites. It is compatible with most of the available databases engines, including MySQL, SQLite, PostgreSQL, Oracle, and Microsoft SQL Server. It runs on linux and Windows platforms.

2. Installation of Symfony

Before install Symfony, you should have the following requirements: WampServer Take a look about the WampServer and composer instalation in my preview tutorial.

3. Installing Composer

Composer is the package manager used by modern PHP applications and the only recommended way to install Symfony2. To install Composer on a Windows system, download from the official web site executable installer.

4. Create a symfony Project

Create a symfony project is not so complicated, but we need to know how do it for example using the command line.
In this tutorial we will create a symfony project called Bookstore and in next tutorial we will implement simple CRUD operation using the same project.
Open a command line and execute the following command to install the latest version of Symfony2 in the "C:/wamp/www" directory:
composer create-project symfony/framework-standard-edition
Bookstore/ ~2.4

This will take time depend of your internet connection, because need to download all the files from the server of symfony and after it will ask you if you want to set up your database, let it by default and you can configure it later.
Installation of Symfony
Go to \Bookstore\src\Acme\DemoBundle\Resources\views\Demo\hello.html.twig And add a line of code where say "Welcome to Symfony2 Development"
{% extends "AcmeDemoBundle::layout.html.twig" %}

{% block title "Hello " ~ name %}

{% block content %}

<h1>Welcome to Symfony2 Development</h1>

<h1>Hello {{ name }}!</h1>

{% endblock %}

{% set code = code(_self) %}

5. Run the Project

Before run Symfony2 for the first time, execute the following command to make sure that your system meets all the technical requirements:
cd Bookstore/
php app/check.php
Try to fix the error appear and then use the PHP built-in web server to run Symfony:
Run the project
  1. This is one way to run the symfony application using the command line
    php app/console server:run

    Open a browser and access the http://localhost:8000/demo/hello/george
  2. Or you can open with the complete path in case you don’t want to run the server(you must know that your wampserver should be running)
Installation of Symfony

6. Next Tutorial CRUD Operation in Symfony

No comments :