sourceability / console-toolbar-bundle
此扩展包可以在控制台/终端中显示网络工具栏。
0.1.13
2023-01-03 10:31 UTC
Requires
- php: ^7.2 || ^8.0
- symfony/console: ^4.4 || ^5.0 || ^6.0
- symfony/dom-crawler: ^4.4 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.0 || ^6.0
- symfony/twig-bundle: ^4.4 || ^5.0 || ^6.0
- symfony/web-profiler-bundle: ^4.4 || ^5.0 || ^6.0
Requires (Dev)
- behat/behat: ^3.7
- friends-of-behat/symfony-extension: ^2.0
- phpstan/phpstan: ^0.12.85 || ^1.0
- phpstan/phpstan-deprecation-rules: ^0.12.6 || ^1.0
- phpstan/phpstan-strict-rules: ^0.12.9 || ^1.0
- phpunit/phpunit: ^7.0 || ^8.0 || ^9.0
- symplify/easy-coding-standard: ^10.0
README
在终端中渲染 symfony 分析器工具栏。
每个面板都链接到相应的网络分析器页面。请确保使用支持超链接的终端以利用此功能。
安装
使用 composer 安装此扩展包
$ composer require --dev sourceability/console-toolbar-bundle
通过更新 config/bundles.php
启用扩展包
return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], // ... FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['dev' => true, 'test' => true], Sourceability\ConsoleToolbarBundle\SourceabilityConsoleToolbarBundle::class => ['dev' => true, 'test' => true], ];
在 config/packages/{dev,test}/sourceability_console_toolbar.yaml
中配置扩展包
sourceability_console_toolbar: toolbar: hidden_panels: - config - form - validator - logger
如果您的应用程序不是暴露在 http://localhost
上,请确保您已经为您的环境配置了 路由请求上下文。
默认情况下,分析器不一定在 test
环境中运行。您可以像这样启用它
--- a/config/packages/test/web_profiler.yaml +++ b/config/packages/test/web_profiler.yaml @@ -3,4 +3,4 @@ web_profiler: intercept_redirects: false framework: - profiler: { collect: false } + profiler: { enabled:true, collect: true, only_exceptions: false }
还可以在 config/routes/test/web_profiler.yaml
中添加网络分析器路由
web_profiler_wdt: resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' prefix: /_wdt web_profiler_profiler: resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' prefix: /_profiler
Behat
当编写/调试 behat 场景时,此扩展包非常有用。
首先通过在您的 behat 配置中添加以下内容来启用 behat 扩展
default: extensions: FriendsOfBehat\SymfonyExtension: ~ Sourceability\ConsoleToolbarBundle\Behat\SymfonyToolbarExtension: ~
这将在新检测到 symfony 分析器时显示控制台工具栏
PHPUnit
将以下内容添加到您的 phpunit.xml
配置中
<extensions> <extension class="Sourceability\ConsoleToolbarBundle\PHPUnit\ConsoleToolbarExtension"> <arguments> <boolean>false</boolean> <!-- always show, if false use: TOOLBAR=true phpunit ...--> <integer>4</integer> <!-- Indentation --> </arguments> </extension> </extensions>
控制台
bin/console
现在有一个新的全局选项 --toolbar
此功能需要 sourceability/instrumentation,并具有以下扩展包配置
sourceability_instrumentation: profilers: symfony: enabled: true listeners: command: enabled: true