Monday, 29 October 2012

Getting Started With Symfony 212

Getting Started With Symfony 212

PART A : Creating an app
METHOD 1
STEP 1 : Download Symfony 2.1.2 and Move it to proper location
sudo mv /home/prayag/Downloads/Symfony_Standard_Vendors_2.1.2.tgz /var/www/

STEP 2 : Unzip Symfony_Standard_Vendors_2.1.2.tgz
tar zxvf Symfony_Standard_Vendors_2.1.2.tgz

STEP 3 : app structure
prayag@prayag:/var/www/Symfony$ ls -l
total 80
drwxr-xr-x  6 prayag prayag  4096 Oct 28 15:39 app
-rw-r--r--  1 prayag prayag  1707 Sep 20 16:14 composer.json
-rw-r--r--  1 prayag prayag 39727 Sep 20 16:14 composer.lock
-rw-r--r--  1 prayag prayag  1065 Sep 20 16:13 LICENSE
-rw-r--r--  1 prayag prayag  5929 Sep 20 16:13 README.md
drwxr-xr-x  3 prayag prayag  4096 Oct 28 15:39 src
-rw-r--r--  1 prayag prayag  7859 Sep 20 16:13 UPGRADE.md
drwxr-xr-x 12 prayag prayag  4096 Oct 28 15:39 vendor
drwxr-xr-x  3 prayag prayag  4096 Sep 20 16:14 web


STEP 4 : make some changes in web/config.php
prayag@prayag:/var/www/Symfony$ sudo vi web/config.php
//I am putting my project name to default values.
<div class="symfony-block-content">
                        <h1>Gwitter!</h1>
                        <p>Gwitter</p>
                        <p>
                            This script will guide you through the basic configuration of your project.
                            You can also do the same by editing the ‘<strong>app/config/parameters.yml</strong>’ file directly.
                        </p>

</div>

STEP 5 : Configure database in parameters.yml
prayag@prayag:/var/www/Symfony$ sudo vi app/config/parameters.yml
parameters:
    database_driver:   pdo_mysql
    database_host:     localhost
    database_port:     3306
    database_name:     Gwitter
    database_user:     root
    database_password: mysql55

    mailer_transport:  smtp
    mailer_host:       localhost
    mailer_user:       ~
    mailer_password:   ~

    locale:            en
    secret:            ThisTokenIsNotSoSecretChangeIt

STEP 6 : Run a Symfony212 app
Goto http://localhost/Symfony/web/config.php and happy coding !!

REFERENCES
http://www.slideshare.net/weaverryan/symfony2-get-your-project-started



PART B : Using Git
STEP 1
prayag@prayag:/var/www/Symfony$ git init
Initialized empty Git repository in /var/www/Symfony/.git/

STEP 2
prayag@prayag:/var/www/Symfony$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .travis.yml
#       LICENSE
#       README.md
#       UPGRADE.md
#       app/
#       composer.json
#       composer.lock
#       src/
#       vendor/
#       web/
nothing added to commit but untracked files present (use "git add" to track)


STEP 3 : Ignore Some Files
create a .gitignore file at the root of the project Gwitter.
prayag@prayag:/var/www/Symfony$ touch .gitignore
prayag@prayag:/var/www/Symfony$ sudo vi .gitignore
/web/bundles/
/app/bootstrap*
/app/cache/*
/app/logs/*
/vendor/
/app/config/parameters.ini

STEP 4 : create an initial commit
prayag@prayag:/var/www/Symfony$ git add .

prayag@prayag:/var/www/Symfony$ git commit -m "[initial framework]"
[master (root-commit) a988523] [initial framework]
 59 files changed, 3732 insertions(+)

No comments:

Post a Comment