Integrate Web Profiler for Zed

Edit on GitHub

The Web Profiler provides a toolbar for debugging and informational purposes. The toolbar is located at the bottom of a loaded page.

Spryker Profiler is based on Symfony Profiler. For details, see Profiler documentation.

Modules

The following modules provide the profiler functionality:

  • WebProfilerWidget -spryker/web-profiler
  • WebProfilerExtension -spryker/web-profiler-extension

Installation

Run the following command to install WebProfilerWidget and the extension module:

composer require spryker/web-profiler --dev

Integration

To be able to use Web Profiler, add  \Spryker\Zed\WebProfiler\Communication\Plugin\Application\WebProfilerApplicationPluginof thespryker-shop/web-profilermodule to \Pyz\Zed\Application\ApplicationDependencyProvider::getApplicationPlugins().

Configure the Web Profiler per Environment

The below options can be used in the Router to configure WebProfiler. The options are contained in \Spryker\Shared\WebProfiler\WebProfilerConstants.

  • \Spryker\Shared\WebProfiler\WebProfilerConstants::IS_WEB_PROFILER_ENABLED- use this option to enable/disable Web Profiler. By default, the widget is disabled.
  • Spryker\Shared\WebProfiler\WebProfilerConstants::PROFILER_CACHE_DIRECTORY- use this option to specify the path where the Web Profiler stores its cache.

Extending WebProfilerWidget

You can extend WebProfiler with \Spryker\Shared\WebProfilerExtension\Dependency\Plugin\WebProfilerDataCollectorPluginInterface. The interface can be used for adding Data Collectors to the profiler.

Individual Data Collectors can be added to \Pyz\Zed\WebProfiler\WebProfilerDependencyProvider::getDataCollectorPlugins().

Spryker provides a lot of build-in collectors. You can locate them in WebProfiler/src/Spryker/Zed/WebProfiler/Communication/Plugin/WebProfiler/.