/symfony list
語法:
symfony [選項] 任務名 [參數]
選項:
–dry-run -n Do a dry run without executing actions.
–help -H 顯示幫助信息
–quiet -q Do not log messages to standard output.
–trace -t Turn on invoke/execute tracing, enable full backtrace.
–version -V 顯示程序版本
可用的任務:
help 顯示任務的幫助信息 (簡寫h)
list 列出任務
app:routes 顯示一個應用程序當前的路由信息
cache:clear 清空緩存(簡寫cc, clear-cache)
configure:author 設置項目作者
configure:database 設置數據庫 DSN
generate:app 初始化一個應用程序 (簡寫init-app)
generate:module 初始化一個模塊 (簡寫init-module)
generate:project 初始化一個項目 (簡寫init-proj)
generate:task Creates a skeleton class for a new task
i18n:extract Extracts i18n strings from php files
i18n:find Finds non “i18n ready” strings in an application
log:clear 清空日志 (log-purge)
log:rotate Rotates an application log files (log-rotate)
plugin:add-channel 添加一個新的PEAR頻道
plugin:install 安裝一個插件 (簡寫plugin-install)
plugin:list 列出已安裝的插件 (簡寫plugin-list)
plugin:publish-assets 將全部插件的web目錄發布到項目的web目錄下
plugin:uninstall 卸載一個插件 (plugin-uninstall)
plugin:upgrade 升級一個插件(plugin-upgrade)
project:clear-controllers Clears all non production environment controllers (clear-controllers)
project:deploy 發布一個項目到另外一臺服務器 (sync)
project:disable 在指定環境下屏蔽一個應用程序 (disable)
project:enable 在指定環境下打開一個應用程序 (disable)
project:freeze 凍結 symfony 庫文件 (簡寫freeze)
project:permissions 修改symfony項目目錄的權限 (permissions, fix-perms)
project:unfreeze 解凍 symfony 庫文件 (簡寫unfreeze)
project:upgrade1.1 將一個symfony項目升級到1.1
project:upgrade1.2 將一個symonfy項目從1.1升級到1.2
propel:build-all 生成model,form,生成sql語句并創建數據庫 (propel-build-all)
propel:build-all-load 生成model,form,生成sql語句,創建數據庫并插入初始數據 (propel-build-all-load)
propel:build-filters 根據當前的模型創建過濾器
propel:build-forms 根據當前的模型創建表單
propel:build-model 根據數據庫結構創建模型 (propel-build-model)
propel:build-schema 根據數據庫結構創建schema (propel-build-schema)
propel:build-sql 根據當前模型創建一個SQL (簡寫propel-build-sql)
propel:data-dump 導出數據到 fixtures directory (propel-dump-data)
propel:data-load 從fixtures directory載入數據 (propel-load-data)
propel:generate-admin 自動生成一個module的后臺
propel:generate-module Generates a Propel module (propel-generate-crud, propel:generate-crud)
propel:generate-module-for-route Generates a Propel module for a route definition
propel:graphviz Generates a graphviz chart of current object model
propel:init-admin 初始化一個module后臺(propel-init-admin)
propel:insert-sql Inserts SQL for current model (propel-insert-sql)
propel:schema-to-xml 根據schema.yml生成schema.xml (propel-convert-yml-schema)
propel:schema-to-yml 根據schema.xml生成schema.yml (propel-convert-xml-schema)
test:all 運行全部測試 (簡寫test-all)
test:coverage Outputs test code coverage
test:functional 運行全部功能測試 (簡寫test-functional)
test:unit 運行單元測試 (test-unit)
./symfony help app:routes
語法:
symfony app:routes application [name]
參數:
application The application name
name A route name
描述:
The app:routes displays the current routes for a given application:
./symfony app:routes frontend
./symfony help cc
語法:
symfony cache:clear [--app[="..."]] [--env[="..."]] [--type[="..."]]
別名: cc, clear-cache
選項:
–app The application name
–env The environment
–type The type (default: all)
描述:
The cache:clear task clears the symfony cache.
By default, it removes the cache for all available types, all applications,
and all environments.
You can restrict by type, application, or environment:
For example, to clear the frontend application cache:
./symfony cache:clear –app=frontend
To clear the cache for the prod environment for the frontend application:
./symfony cache:clear –app=frontend –env=prod
To clear the cache for all prod environments:
./symfony cache:clear –env=prod
To clear the config cache for all prod environments:
./symfony cache:clear –type=config –env=prod
The built-in types are: config, i18n, routing, module
and template.
./symfony help configure:author
語法:
symfony configure:author author
參數:
author The project author
描述:
The configure:author task configures the author for a project:
./symfony configure:author “Fabien Potencier <fabien.potencier@symfony-project.com>”
The author is used by the generates to pre-configure the PHPDoc header for each generated file.
The value is stored in [config/properties.ini].
./symfony help configure:database
語法:
symfony configure:database [--env[="..."]] [--name[="..."]] [--class[="..."]] [--app[="..."]] dsn [username] [password]
參數:
dsn The database dsn
username The database username (default: root)
password The database password
選項:
–env The environment (default: all)
–name The connection name (default: propel)
–class The database class name (default: sfPropelDatabase)
–app The application name
描述:
The configure:database task configures the database DSN
for a project:
./symfony configure:database mysql:host=localhost;dbname=example root mYsEcret
By default, the task change the configuration for all environment. If you want
to change the dsn for a specific environment, use the env option:
./symfony configure:database –env=dev mysql:host=localhost;dbname=example_dev root mYsEcret
To change the configuration for a specific application, use the app option:
./symfony configure:database –app=frontend mysql:host=localhost;dbname=example root mYsEcret
You can also specify the connection name and the database class name:
./symfony configure:database –name=main –class=sfDoctrineDatabase mysql:host=localhost;dbname=example root
WARNING: The propel.ini file is also updated when you use a Propel database
and configure for all environments with no app.
./symfony help generate:app
語法:
symfony generate:app [--escaping-strategy="..."] [--csrf-secret="..."] application
別名: init-app
參數:
application The application name
選項:
–escaping-strategy Output escaping strategy (default: )
–csrf-secret Secret to use for CSRF protection (default: )
描述:
The generate:app task creates the basic directory structure
for a new application in the current project:
./symfony generate:app frontend
This task also creates two front controller scripts in the
web/ directory:
web/%application%.php for the production environment
web/%application%_dev.php for the development environment
For the first application, the production environment script is named
index.php.
If an application with the same name already exists,
it throws a sfCommandException.
You can enable output escaping (to prevent XSS) by using the escaping-strategy option:
./symfony generate:app frontend –escaping-strategy=on
You can enable session token in forms (to prevent CSRF) by defining
a secret with the csrf-secret option:
./symfony generate:app frontend –csrf-secret=UniqueSecret
./symfony help generate:module
語法:
symfony generate:module application module
別名: init-module
參數:
application The application name
module The module name
描述:
The generate:module task creates the basic directory structure
for a new module in an existing application:
./symfony generate:module frontend article
The task can also change the author name found in the actions.class.php
if you have configure it in config/properties.ini:
[symfony]
name=blog
author=Fabien Potencier <fabien.potencier@sensio.com>
You can customize the default skeleton used by the task by creating a
%sf_data_dir%/skeleton/module directory.
The task also creates a functional test stub named
%sf_test_dir%/functional/%application%/%module%ActionsTest.class.php
that does not pass by default.
If a module with the same name already exists in the application,
it throws a sfCommandException.
./symfony help generate:project
用方法:
symfony generate:project name
別名: init-project
參數:
name The project name
描述:
The generate:project task creates the basic directory structure
for a new project in the current directory:
./symfony generate:project blog
If the current directory already contains a symfony project,
it throws a sfCommandException.
./symfony help generate:task
語法:
symfony generate:task [--dir="..."] [--use-database="..."] [--brief-description="..."] task_name
參數:
task_name The task name (can contain namespace)
選項:
–dir The directory to create the task in (default: lib/task)
–use-database Whether the task needs model initialization to access database (default: propel)
–brief-description A brief task description (appears in task list)
描述:
The generate:task creates a new sfTask class based on the name passed as
argument:
./symfony generate:task namespace:name
The namespaceNameTask.class.php skeleton task is created under the lib/task/
directory. Note that the namespace is optional.
If you want to create the file in another directory (relative to the project
root folder), pass it in the –dir option. This directory will be created
if it does not already exist.
./symfony generate:task namespace:name –dir=plugins/myPlugin/lib/task
If you want the task to default to a connection other than propel, provide
the name of this connection with the –use-database option:
./symfony generate:task namespace:name –use-database=main
The –use-database option can also be used to disable database
initialization in the generated task:
./symfony generate:task namespace:name –use-database=false
You can also specify a description:
./symfony generate:task namespace:name –brief-description=”Does interesting things”
./symfony help i18n:extract
語法:
symfony i18n:extract [--display-new] [--display-old] [--auto-save] [--auto-delete] application culture
參數:
application The application name
culture The target culture
選項:
–display-new Output all new found strings
–display-old Output all old strings
–auto-save Save the new strings
–auto-delete Delete old strings
描述:
The i18n:extract task extracts i18n strings from your project files
for the given application and target culture:
./symfony i18n:extract frontend fr
By default, the task only displays the number of new and old strings
it found in the current project.
If you want to display the new strings, use the –display-new option:
./symfony i18n:extract –display-new frontend fr
To save them in the i18n message catalogue, use the –auto-save option:
./symfony i18n:extract –auto-save frontend fr
If you want to display strings that are present in the i18n messages
catalogue but are not found in the application, use the
–display-old option:
./symfony i18n:extract –display-old frontend fr
To automatically delete old strings, use the –auto-delete but
be careful, especially if you have translations for plugins as they will
appear as old strings but they are not:
./symfony i18n:extract –auto-delete frontend fr
./symfony help i18n:find
語法:
symfony i18n:find [--env="..."] application
參數:
application The application name
選項:
–env The environment (default: dev)
描述:
The i18n:find task finds non internationalized strings embedded in templates:
./symfony i18n:find frontend
This task is able to find non internationalized strings in pure HTML and in PHP code:
Non i18n text
As the task returns all strings embedded in PHP, you can have some false positive (especially
if you use the string syntax for helper arguments).
./symfony help log:clear
語法:
symfony log:clear
別名: log-purge
描述:
The log:clear task clears all symfony log files:
./symfony log:clear
./symfony help log:rotate
語法:
symfony log:rotate [--history="..."] [--period="..."] application env
別名: log-rotate
參數:
application The application name
env The environment name
選項:
–history The maximum number of old log files to keep (default: 10)
–period The period in days (default: 7)
描述:
The log:rotate task rotates application log files for a given
environment:
./symfony log:rotate frontend dev
You can specify a period or a history option:
./symfony –history=10 –period=7 log:rotate frontend dev
./symfony help plugin:add-channel
語法:
symfony plugin:add-channel name
參數:
name The channel name
描述:
The plugin:add-channel task adds a new PEAR channel:
./symfony plugin:add-channel symfony.plugins.pear.example.com
./symfony help plugin:install
語法:
symfony plugin:install [--stability|-s="..."] [--release|-r="..."] [--channel|-c="..."] [--install_deps|-d] [--force-license] name
別名: plugin-install
參數:
name The plugin name
選項:
–stability (-s) The preferred stability (stable, beta, alpha)
–release (-r) The preferred version
–channel (-c) The PEAR channel name
–install_deps (-d) Whether to force installation of required dependencies
–force-license Whether to force installation even if the license is not MIT like
描述:
The plugin:install task installs a plugin:
./symfony plugin:install sfGuardPlugin
By default, it installs the latest stable release.
If you want to install a plugin that is not stable yet,
use the stability option:
./symfony plugin:install –stability=beta sfGuardPlugin
./symfony plugin:install -s beta sfGuardPlugin
You can also force the installation of a specific version:
./symfony plugin:install –release=1.0.0 sfGuardPlugin
./symfony plugin:install -r 1.0.0 sfGuardPlugin
To force installation of all required dependencies, use the install_deps flag:
./symfony plugin:install –install-deps sfGuardPlugin
./symfony plugin:install -d sfGuardPlugin
By default, the PEAR channel used is symfony-plugins
(plugins.symfony-project.org).
You can specify another channel with the channel option:
./symfony plugin:install –channel=mypearchannel sfGuardPlugin
./symfony plugin:install -c mypearchannel sfGuardPlugin
Or you can use the channel/package notation:
./symfony plugin:install mypearchannel/sfGuardPlugin
You can also install PEAR packages hosted on a website:
./symfony plugin:install http://somewhere.example.com/sfGuardPlugin-1.0.0.tgz
Or local PEAR packages:
./symfony plugin:install /home/fabien/plugins/sfGuardPlugin-1.0.0.tgz
If the plugin contains some web content (images, stylesheets or javascripts),
the task creates a %name% symbolic link for those assets under web/.
On Windows, the task copy all the files to the web/%name% directory.
./symfony help plugin:list
語法:
symfony plugin:list
別名: plugin-list
描述:
The plugin:list task lists all installed plugins:
./symfony plugin:list
It also gives the channel and version for each plugin.
./symfony help plugin:publish-assets
語法:
symfony plugin:publish-assets [--core-only] [--symfony-lib-dir="..."]
選項:
–core-only If set only core plugins will publish their assets
–symfony-lib-dir The symfony lib dir
描述:
The plugin:publish-assets task will publish web assets from all plugins.
./symfony plugin:publish-assets
In fact this will send the plugin.post_install event to each plugin.
./symfony help plugin:uninstall
語法:
symfony plugin:uninstall [--channel|-c="..."] [--install_deps|-d] name
別名: plugin-uninstall
參數:
name The plugin name
選項:
–channel (-c) The PEAR channel name
–install_deps (-d) Whether to force installation of dependencies
描述:
The plugin:uninstall task uninstalls a plugin:
./symfony plugin:uninstall sfGuardPlugin
The default channel is symfony.
You can also uninstall a plugin which has a different channel:
./symfony plugin:uninstall –channel=mypearchannel sfGuardPlugin
./symfony plugin:uninstall -c mypearchannel sfGuardPlugin
Or you can use the channel/package notation:
./symfony plugin:uninstall mypearchannel/sfGuardPlugin
You can get the PEAR channel name of a plugin by launching the
plugin:list] task.
If the plugin contains some web content (images, stylesheets or javascripts),
the task also removes the [web/%name% symbolic link (on *nix)
or directory (on Windows).
./symfony help plugin:upgrade
語法:
symfony plugin:upgrade [--stability|-s="..."] [--release|-r="..."] [--channel|-c="..."] name
別名: plugin-upgrade
參數:
name The plugin name
選項:
–stability (-s) The preferred stability (stable, beta, alpha)
–release (-r) The preferred version
–channel (-c) The PEAR channel name
描述:
The plugin:upgrade task tries to upgrade a plugin:
./symfony plugin:upgrade sfGuardPlugin
The default channel is symfony.
If the plugin contains some web content (images, stylesheets or javascripts),
the task also updates the web/%name% directory content on Windows.
See plugin:install for more information about the format of the plugin name and options.
./symfony help project:clear-controllers
語法:
symfony project:clear-controllers
別名: clear-controllers
描述:
The project:clear-controllers task clears all non production environment
controllers:
./symfony project:clear-controllers
You can use this task on a production server to remove all front
controller scripts except the production ones.
If you have two applications named frontend and backend,
you have four default controller scripts in web/:
index.php
frontend_dev.php
backend.php
backend_dev.php
After executing the project:clear-controllers task, two front
controller scripts are left in web/:
index.php
backend.php
Those two controllers are safe because debug mode and the web debug
toolbar are disabled.
./symfony help project:deploy
語法:
symfony project:deploy [--go] [--rsync-dir="..."] [--rsync-options[="..."]] server
別名: sync
參數:
server The server name
選項:
–go Do the deployment
–rsync-dir The directory where to look for rsync*.txt files (default: config)
–rsync-options To options to pass to the rsync executable (default: -azC –force –delete)
描述:
The project:deploy task deploys a project on a server:
./symfony project:deploy production
The server must be configured in config/properties.ini:
[production]
host=www.example.com
port=22
user=fabien
dir=/var/www/sfblog/
type=rsync
To automate the deployment, the task uses rsync over SSH.
You must configure SSH access with a key or configure the password
in config/properties.ini.
By default, the task is in dry-mode. To do a real deployment, you
must pass the –go option:
./symfony project:deploy –go production
Files and directories configured in config/rsync_exclude.txt are
not deployed:
.svn
/web/uploads/*
/cache/*
/log/*
You can also create a rsync.txt and rsync_include.txt files.
If you need to customize the rsync*.txt files based on the server,
you can pass a rsync-dir option:
./symfony project:deploy –go –rsync-dir=config/production production
Last, you can specify the options passed to the rsync executable, using the
rsync-options option (defaults are -azC):
./symfony project:deploy –go –rsync-options=avz
./symfony help project:disable
語法:
symfony project:disable application env
別名: disable
參數:
application The application name
env The environment name
描述:
The project:disable task disables an application for a specific environment:
./symfony project:disable frontend prod
./symfony help project:enable
語法:
symfony project:enable application env
別名: enable
參數:
application The application name
env The environment name
描述:
The project:enable task enables an application for a specific environment:
./symfony project:enable frontend prod
./symfony help project:freeze
語法:
symfony project:freeze symfony_data_dir
別名: freeze
參數:
symfony_data_dir The symfony data directory
描述:
The project:freeze task copies all the symfony core files to
the current project:
./symfony project:freeze /path/to/symfony/data/directory
The task takes a mandatory argument of the path to the symfony data
directory.
The task also changes config/config.php to switch to the
embedded symfony files.
./symfony help project:permissions
語法:
symfony project:permissions
別名: permissions, fix-perms
描述:
The project:permissions task fixes directory permissions:
./symfony project:permissions
./symfony help project:unfreeze
語法:
symfony project:unfreeze
別名: unfreeze
描述:
The project:unfreeze task removes all the symfony core files from
the current project:
./symfony project:unfreeze
The task also changes config/config.php to switch to the
old symfony files used before the project:freeze command was used.
./symfony help project:upgrade1.1
語法:
symfony project:upgrade1.1
描述:
The project:upgrade1.1 task upgrades a symfony project
based the 1.0 release to the 1.1 symfony release.
./symfony project:upgrade1.1
Please read the UPGRADE_TO_1_1 file to have information on what does this task.
./symfony help project:upgrade1.2
語法:
symfony project:upgrade1.2
描述:
The project:upgrade1.2 task upgrades a symfony project
based on the 1.1 release to the 1.2 symfony release.
./symfony project:upgrade1.2
&nbs