by prettyscripts on 2010-03-22 12:45:30
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):
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.
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.
Code:
$ php lib/vendor/symfony/data/bin/symfony -V | |
$ php lib/vendor/symfony/data/bin/check_configuration.php |
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.
Code:
$ php symfony generate:app <application name> |
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] |
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
Code:
$ php symfony app:routes <application> |
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.
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.
symfony command can only be called from project root. but there is shortcut to call anywhere under the project root.
for a complete list of tasks for the symfony command, read this.
Tags: symfony, symfony commands