Symfony命令大全

执行命令:

$ php bin/console

 查看一下命令

Symfony version 3.1.5 - app/dev/debug

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "dev"]
      --no-debug        Switches off debug mode.
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output,
 2 for more verbose output and 3 for debug

Available commands:
  help                                    Displays help for a command
  list                                    Lists commands
 assets
  assets:install                          Installs bundles web assets under a pu
blic web directory
 cache
  cache:clear                             Clears the cache
  cache:warmup                            Warms up an empty cache
 config
  config:dump-reference                   Dumps the default configuration for an
 extension
 debug
  debug:config                            Dumps the current configuration for an
 extension
  debug:container                         Displays current services for an appli
cation
  debug:event-dispatcher                  Displays configured listeners for an a
pplication
  debug:router                            Displays current routes for an applica
tion
  debug:swiftmailer                       Displays current mailers for an applic
ation
  debug:translation                       Displays translation messages informat
ion
  debug:twig                              Shows a list of twig functions, filter
s, globals and tests
 doctrine
  doctrine:cache:clear-collection-region  Clear a second-level cache collection
region.
  doctrine:cache:clear-entity-region      Clear a second-level cache entity regi
on.
  doctrine:cache:clear-metadata           Clears all metadata cache for an entit
y manager
  doctrine:cache:clear-query              Clears all query cache for an entity m
anager
  doctrine:cache:clear-query-region       Clear a second-level cache query regio
n.
  doctrine:cache:clear-result             Clears result cache for an entity mana
ger
  doctrine:database:create                Creates the configured database
  doctrine:database:drop                  Drops the configured database
  doctrine:database:import                Import SQL file(s) directly to Databas
e.
  doctrine:ensure-production-settings     Verify that Doctrine is properly confi
gured for a production environment.
  doctrine:generate:crud                  Generates a CRUD based on a Doctrine e
ntity
  doctrine:generate:entities              Generates entity classes and method st
ubs from your mapping information
  doctrine:generate:entity                Generates a new Doctrine entity inside
 a bundle
  doctrine:generate:form                  Generates a form type class based on a
 Doctrine entity
  doctrine:mapping:convert                Convert mapping information between su
pported formats.
  doctrine:mapping:import                 Imports mapping information from an ex
isting database
  doctrine:mapping:info
  doctrine:migrations:diff                Generate a migration by comparing your
 current database to your mapping information.
  doctrine:migrations:execute             Execute a single migration version up
or down manually.
  doctrine:migrations:generate            Generate a blank migration class.
  doctrine:migrations:latest              Outputs the latest version number
  doctrine:migrations:migrate             Execute a migration to a specified ver
sion or the latest available version.
  doctrine:migrations:status              View the status of a set of migrations
.
  doctrine:migrations:version             Manually add and delete migration vers
ions from the version table.
  doctrine:query:dql                      Executes arbitrary DQL directly from t
he command line.
  doctrine:query:sql                      Executes arbitrary SQL directly from t
he command line.
  doctrine:schema:create                  Executes (or dumps) the SQL needed to
generate the database schema
  doctrine:schema:drop                    Executes (or dumps) the SQL needed to
drop the current database schema
  doctrine:schema:update                  Executes (or dumps) the SQL needed to
update the database schema to match the current mapping metadata.
  doctrine:schema:validate                Validate the mapping files.
 fos
  fos:user:activate                       Activate a user
  fos:user:change-password                Change the password of a user.
  fos:user:create                         Create a user.
  fos:user:deactivate                     Deactivate a user
  fos:user:demote                         Demote a user by removing a role
  fos:user:promote                        Promotes a user by adding a role
 generate
  generate:bundle                         Generates a bundle
  generate:command                        Generates a console command
  generate:controller                     Generates a controller
  generate:doctrine:crud                  Generates a CRUD based on a Doctrine e
ntity
  generate:doctrine:entities              Generates entity classes and method st
ubs from your mapping information
  generate:doctrine:entity                Generates a new Doctrine entity inside
 a bundle
  generate:doctrine:form                  Generates a form type class based on a
 Doctrine entity
 liip
  liip:imagine:cache:remove               Remove cache for given paths and set o
f filters.
  liip:imagine:cache:resolve              Resolve cache for given path and set o
f filters.
 lint
  lint:twig                               Lints a template and outputs encounter
ed errors
  lint:yaml                               Lints a file and outputs encountered e
rrors
 orm
  orm:convert:mapping                     Convert mapping information between su
pported formats.
 router
  router:match                            Helps debug routes by simulating a pat
h info match
 security
  security:check                          Checks security issues in your project
 dependencies
  security:encode-password                Encodes a password.
 server
  server:run                              Runs PHP built-in web server
  server:start                            Starts PHP built-in web server in the
background
  server:status                           Outputs the status of the built-in web
 server for the given address
  server:stop                             Stops PHP's built-in web server that w
as started with the server:start command
 swiftmailer
  swiftmailer:debug                       Displays current mailers for an applic
ation
  swiftmailer:email:send                  Send simple email message
  swiftmailer:spool:send                  Sends emails from the spool
 translation
  translation:update                      Updates the translation file
 vich
  vich:mapping:debug                      Debug a mapping.
  vich:mapping:debug-class                Debug a class.
  vich:mapping:list-classes               Searches for uploadable classes.

 中文如下

 1 Available commands:
 2  help                                  显示命令的帮助信息
 3  list                                  命令列表
 4 assetic
 5  assetic:dump                          将所有asset保存到文件系统。
 6 assets
 7  assets:install                        在公用网站目录中安装各Bundle网站的asset。
 8 cache
 9  cache:clear                           清除缓存
10  cache:warmup                          Warms up一个空的缓存
11 config
12  config:debug                          将当前配置扩展
13  config:dump-reference                 将默认配置扩展
14 container
15  container:debug                       为应用程序显示当前服务
16 debug
17  debug:config                          将当前配置的扩展
18  debug:container                       显示应用程序的当前服务
19  debug:event-dispatcher                显示应用程序的配置监听器
20  debug:router                          显示应用程序的当前路径
21  debug:swiftmailer                     显示应用程序的当前邮件
22  debug:translation                     显示消息信息的翻译
23  debug:twig                            列表显示Twig的功能,过滤器,全局变量和测试
24 doctrine
25  doctrine:cache:clear-metadata         为一个实体管理器清除所有的元数据缓存。
26  doctrine:cache:clear-query            为一个实体管理器清除所有的查询缓存
27  doctrine:cache:clear-result           为一个实体管理器清除结果缓存
28  doctrine:database:create              创建一个已配置的数据库
29  doctrine:database:drop                删除一个已配置的数据库
30  doctrine:ensure-production-settings   确认在生产环境下Doctrine的配置是正确的
31  doctrine:generate:crud                基于Doctrine实体生成增删改查(CRUD)
32  doctrine:generate:entities            从您的映射信息中生成实体类和方法的存根
33  doctrine:generate:entity              生成Bundle中的新Doctrine实体
34  doctrine:generate:form                基于Doctrine实体生成一个表单类型类
35  doctrine:mapping:convert              在支持的格式间转换映射信息
36  doctrine:mapping:import               从已存在的数据库中导入映射信息
37  doctrine:mapping:info                 显示所有被映射实体的基本信息
38  doctrine:query:dql                    直接从命令行中运行任何的DQL
39  doctrine:query:sql                    直接从命令行中运行任何的SQL
40  doctrine:schema:create                执行(或转储)生成数据库方案所需的SQL语句
41  doctrine:schema:drop                  执行(或转储)删除数据库方案所需的SQL语句
42  doctrine:schema:update                执行(或转储)更新匹配当前映射元数据数据库方案所需的SQL语句
43 generate
44  generate:bundle                       生成Bundle
45  generate:controller                   生成一个控制器
46  generate:doctrine:crud                基于Doctrine实体生成CRUD
47  generate:doctrine:entities            从您的映射信息中生成实体类和方法的存根
48  generate:doctrine:entity              在Bundle中生成一个Doctrine的新实体
49  generate:doctrine:form                基于Doctrine实体生成一个表单类型类
50 init
51  init:acl                              在数据库中安装ACL数据表
52 orm
53  orm:convert:mapping                   转换支持格式之间的映射信息
54 router
55  router:debug                          为应用程序显示当前路由
56  router:dump-apache                    将所有路由转储为Apache重写规则
57 security
58  security:check                        检查你的项目依赖项的安全问题
59 server
60  server:run                            运行PHP内置的Web服务器
61  server:start                          在后台开始PHP内置的Web服务器
62  server:status                         输出给定地址的内置Web服务器的状态
63  server:stop                           从服务器的启动命令停止PHP内置的Web服务器
64 swiftmailer
65  swiftmailer:debug                     显示应用程序的当前邮件
66  swiftmailer:email:send                简单的邮件发送
67  swiftmailer:spool:send                从池中发送电子邮件
68 translation
69  translation:debug                     显示消息信息的翻译
70  translation:update                    更新翻译文件
71 twig
72  twig:debug                            列表显示Twig的功能,过滤器,全局变量和测试
73  twig:lint                             lint一个模板输出遇到的错误
74 yaml
75  yaml:lint                             lint一个文件输出遇到的错误
View Code

 

微信公众号:

 

转载于:https://www.cnblogs.com/Amos-Turing/p/5988521.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Symfony/mailer是一个用于发送电子邮件的组件,使用方法如下: 1. 安装组件 可以通过composer来安装Symfony/mailer组件,命令如下: ``` composer require symfony/mailer ``` 2. 配置邮件传输 在配置文件中添加邮件传输器,可以使用内置的SMTP或sendmail传输器,或者使用其他第三方传输器。以下是使用SMTP传输器的示例配置: ```yaml # config/packages/mailer.yaml framework: mailer: dsn: 'smtp://localhost' ``` 3. 创建邮件 使用Symfony/mailer可以通过创建邮件对象来发送电子邮件。可以设置邮件的收件人、发件人、主题、正文等内容。以下是创建邮件的示例代码: ```php use Symfony\Component\Mime\Email; $email = (new Email()) ->from('[email protected]') ->to('[email protected]') ->subject('Test email') ->text('This is a test email.'); ``` 4. 发送邮件 使用MailerInterface来发送邮件,以下是发送邮件的示例代码: ```php use Symfony\Component\Mailer\MailerInterface; $mailer->send($email); ``` 以上就是Symfony/mailer的使用方法。如果您需要更详细的说明,请参考官方文档。 ### 回答2: Symfony/mailer是Symfony框架中的一项功能强大的邮件发送组件。它提供了一个简单且高效的方式来发送电子邮件。 要使用Symfony/mailer发送邮件,首先需要在Symfony项目中安装相关依赖包。可以使用Composer运行`composer require symfony/mailer`命令来安装。 安装完成后,需要在配置文件(例如`config/packages/mailer.yaml`)中进行一些基本的配置,如设置邮件传输通道和SMTP服务器的相关信息。 配置完成后,就可以在控制器或服务中使用Symfony/mailer发送邮件。首先,我们需要在使用的地方引入邮件类:`use Symfony\Component\Mailer\MailerInterface;`。 然后,我们可以像这样在控制器中使用`MailerInterface`来发送邮件: ```php use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mime\Email; class MyController { private $mailer; public function __construct(MailerInterface $mailer) { $this->mailer = $mailer; } public function sendEmail() { $email = (new Email()) ->from('[email protected]') ->to('[email protected]') ->subject('Hello') ->text('This is a test email.'); $this->mailer->send($email); // 邮件发送成功后的其他逻辑... } } ``` 在上面的例子中,我们首先创建了一个`Email`对象,并设置了发件人、收件人、主题和邮件正文。然后,通过调用`send()`方法来发送该邮件。 除了基本的邮件发送,Symfony/mailer还提供了许多其他功能,如附件发送、HTML邮件、内联图像、邮件队列等等。我们可以根据需要进行相应设置。 总之,Symfony/mailer是一个功能强大且易于使用的邮件发送组件,通过一些简单的配置和几行代码,我们就可以在Symfony框架中轻松地发送邮件。 ### 回答3: Symfony/mailer是Symfony框架的一部分,用于发送电子邮件。以下是Symfony/mailer的使用方式: 1. 首先,确保已经安装了Symfony框架,并在项目中启用了Symfony/mailer组件。可以使用Composer命令来安装依赖项:composer require symfony/mailer。 2. 接下来,配置邮件发送器。打开config/packages/mailer.yaml文件,并添加以下配置: mailer_dsn: 'smtp://localhost:25' 这里的mailer_dsn是SMTP服务器的配置信息,可以根据自己的需要进行修改。 3. 创建邮件实例。可以通过实例化Symfony\Component\Mailer\Mailer类来创建邮件对象。例如: use Symfony\Component\Mailer\Mailer; use Symfony\Component\Mime\Email; $mailer = new Mailer($mailerTransport); $email = (new Email()) ->from('[email protected]') ->to('[email protected]') ->subject('Hello!') ->text('This is the plain text message.') ->html('<p>This is the HTML message.</p>'); 4. 发送邮件。可以使用$mailer实例的send()方法来发送邮件对象。例如: $mailer->send($email); 这将把邮件发送给收件人。 以上就是Symfony/mailer的简单使用方式。通过配置文件来设置SMTP服务器,然后创建邮件对象并发送,可以方便地在Symfony框架中发送电子邮件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值