sourceability / console-toolbar-bundle
This bundle enables displaying the web toolbar in the console/terminal.
Installs: 356 393
Dependents: 0
Suggesters: 0
Security: 0
Stars: 55
Watchers: 3
Forks: 4
Open Issues: 2
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
Render the symfony profiler toolbar in your terminal.
Each panel links to the corresponding web profiler page. Make sure to use a terminal that support hyperlinks to leverage this feature.
Installation
Install the bundle using composer:
$ composer require --dev sourceability/console-toolbar-bundle
Enable the bundle by updating 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], ];
Configure the bundle in config/packages/{dev,test}/sourceability_console_toolbar.yaml
:
sourceability_console_toolbar: toolbar: hidden_panels: - config - form - validator - logger
If your application is not exposed at http://localhost
exactly, make sure that
you've configured the router request context for your environment.
By default, the profiler does not always run in the test
environment.
You can enable it like this:
--- 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 }
Also add web profiler routes in 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
This bundle becomes really useful when writing/debugging behat scenarios.
First enable the behat extension by adding the following to your behat configuration:
default: extensions: FriendsOfBehat\SymfonyExtension: ~ Sourceability\ConsoleToolbarBundle\Behat\SymfonyToolbarExtension: ~
This will display the console toolbar whenever a new symfony profile is detected:
PHPUnit
Add the following to your phpunit.xml
configuration:
<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>
Console
bin/console
now has a new global option --toolbar
:
This feature requires sourceability/instrumentation with the following bundle configuration:
sourceability_instrumentation: profilers: symfony: enabled: true listeners: command: enabled: true