Symfony2 Cheat Sheet

I’ve been using Symfony2 for a few weeks now. Symfony2 is a robust web framework for web applications and will become a central tool for Drupal-ists like myself. This is the first in a bunch of posts on this cool framework.

Here’s some cool Symfony2 cheats and commands to remember. These are based on my use of Symfony2 on OS-X.

Clear cache:
$ php app/console cache:clear –env=prod

Create a Bundle:
$ php app/console generate:bundle –namespace=MyBundle/Bundle –format=yml

Publishing web assets:
php app/console assets:install web

Symlink the web assets:
$ php app/console assets:install web –symlink

Load Fixtures:
$ php app/console doctrine:fixtures:load

Generate Entities:
$ php app/console doctrine:generate:entities Entities

Create a database:
$ php app/console doctrine:database:create

Create a schema:
$ php app/console doctrine:schema:create

Update DB Schema:

$ php app/console doctrine:migrations:diff
$ php app/console doctrine:migrations:migrate

Composer:

Get Composer:
$ curl -s https://getcomposer.org/installer | php

Composer Symfony2:
$ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0

Update Composer:
$ php composer.phar self-update

Install the vendors:
$ php composer.phar install

Update Composer Dependencies:
$ php composer.phar update

Great OS-X Commands:

Show hidden files in finder:
$ defaults write com.apple.Finder AppleShowAllFiles TRUE
$ killall finder

Hide the hidden folders in finder:
$ defaults write com.apple.Finder AppleShowAllFiles FALSE
$ killall finder

Anything in italics replace with your own names. I’ll keep on building this.

 

1 Response

Leave a Reply