evozon-php / profiler-command-runner
Evozon ProfilerCommandRunner
dev-master
2018-11-22 08:09 UTC
Requires
- php: ^7.1.3
- symfony/routing: ~3.4|~4.0
- symfony/web-profiler-bundle: ~3.4|~4.0
This package is auto-updated.
Last update: 2024-09-22 22:32:43 UTC
README
此扩展允许用户直接从 Web 调试器工具栏中运行 symfony 控制台命令。
为了设置 Web 调试器工具栏,请参考官方 symfony 文档中的包说明。
此功能仅适用于 QA/开发环境。
其目标是减少像“请你在 QA 服务器3上重新运行导入”这样的请求数量。它允许技术能力较低的个人在看到的应用实例上运行命令,而无需连接到服务器。
安装
Composer
composer require evozon-php/profiler-command-runner
启用扩展
当使用 symfony/flex
时,该扩展自动配置并准备就绪!
对于 symfony 3.x 及以下版本,请按照以下步骤操作
步骤1:注册扩展
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Evozon\Bundle\ProfilerCommandRunner\ProfilerCommandRunnerBundle(),
// ...
);
}
步骤2:注册路由
// app/config/routing.yml
_profiler_command_runner:
resource: '@ProfilerCommandRunner/Resources/config/routes.xml'
使用方法
安装并启用扩展后,在浏览器中访问您的应用程序。
如果 Web 调试器工具栏已启用,它应该包含一个额外的条目,包含一个输入框和一个“运行”按钮。
任何通过运行 ./bin/console command:name:here --with=parameters
可在应用程序中使用的命令也将通过用户界面运行。
命令执行完成后,将鼠标悬停在 Web 调试器工具栏的输入框上,即可显示命令的输出。
例如,尝试 list --raw
警告#1
您可以从 Web 调试器工具栏运行 任何 命令。
即使是破坏性命令,如 doctrine:database:delete --force
也可以!
警告#2
当使用负载均衡器后面的多台服务器时,此扩展将 仅 在一台服务器(负载均衡器为该请求提供的服务器)上运行命令。