symfony commands: from creating project to deployment

by prettyscripts on 2010-03-22 12:45:30

symfony

symfony can be called from command line with many options, from installation and project / module creation to project deployments. i don't have the best memories to remember them. i'm trying to document them all in one place so that i don't have to look all over the places when i need them. if there are anything missing or errors, please comment.

here are step by step commands on unix (linux):

download and install symfony

if you don't already have copy, download the latest version.

i prefer to untar to a centralized location for php libraries and link the directory to projects, so that i don't have too many copies all over the places.

create project

Code:

$ mkdir -p /path/to/project
$ cd /path/to/project
$ mkdir -p lib/vendor
$ ln -s /path/to/symfony .

note: 4 - i prefer to link, but you can cp the untar symfony directory to lib/vendor instead.

check version and server configuration

Code:

$ php lib/vendor/symfony/data/bin/symfony -V
$ php lib/vendor/symfony/data/bin/check_configuration.php

create project

Code:

$ php lib/vendor/symfony/data/bin/symfony generate:project <project>

for better portability, edit path config/ProjectConfiguration.class.php:

PHP:

require_once dirname(__FILE__) . '/../lib/vendor/symfony/lib/....'

optional if using doctrine: set correct default character encoding.

create application(s)

Code:

$ php symfony generate:app <application name>

database related

define tables in config/doctrine/schema.yml. default data in data/fixtures. edit config/databases.yml or:

Code:

$ php symfony configure:database "mysql:host=localhost;dbname=<dbname>" <dbuser> <dbpassword>
$ php symfony doctrine:build --all [--and-load] [--no-confirmation]

create modules

Code:

$ php symfony doctrine:generate-module [--with-show --non-verbose-templates] <app> <module> <model>
$ php symfony doctrine:generate-admin <app> <model> [--module=<module>]

note: 1 - basic crud based. 2- backend interface

check routes

Code:

$ php symfony app:routes <application>

plugins

edit config/ProjectConfiguration.class.php to enable plugin.

Code:

$ php symfony plugins:install <plugin>
$ php symfony plugin:publish-assets

note: 1 - if the server does not have internet access, download and untar to /path/to/project/plugins.

deployment

remember to customize error pages.

edit config/properties.ini and add:

Code:

[production]
  host=<url or ip>
  port=22
  user=<username>
  dir=/path/to/production/project

edit config/rsync_exclude.txt to exclude files to copy to production.

copy files to production website:

Code:

$ php symfony project:deploy production [--go]

note: run without --go option to test.

command shortcut

symfony command can only be called from project root. but there is shortcut to call anywhere under the project root.

other tasks

for a complete list of tasks for the symfony command, read this.

Tags: symfony, symfony commands

No feedback yet

Leave a comment


Your email address will not be revealed on this site.
PoorExcellent
note: all comments are moderated. do not spam and do not advertise. only comments relevant to the post will be published.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)