Web Profiler in Drupal 8
★ Profiling Drupal
★ Web Profiler
★ Web Profiler with Drupal 8
★ Installing Libraries
★ IDE Integration
What is Profiling Drupal
● In the beginning of any Drupal project the site loads very quickly because there aren’t
many modules installed. But as you keep adding modules, the performance of the site
● Profiling your site is extremely useful not only for debugging and performance testing
but also for learning about how your site handles requests.
● If you’re on Drupal 7, just enable query logging using the Devel module. This will show
all the queries generated at the bottom of the page.
● But for Drupal 8 we have something better: Web Profiler.
What is Web Profiler
● Web profiler is a bundle of symfony and in drupal 8 we are using symfony
● Web profiler is a module in Drupal 8.
● Using the Web Profiler, you can profile any Drupal 8 page, which will analyze the
performance and the internal structure of a website/page.
Web Profiler with Drupal 8
● Web profiler is a sub module of Devel module.
● The module will render a fixed bar at the bottom of each page for users.
● This module also provide permission for each role - The View webprofiler toolbar
● This module provides the configuration page (Go to Configuration ->
development -> Devel settings -> Web profiler) where you can do
configuration related to toolbar items, IDE settings.
● By clicking on any of the items from toolbar, you will be taken to the full
● This libraries are optional, without installing libraries web profiler will
work in drupal 8.
● Highlight.js is used to highlight the syntax of queries.
● Create /libraries/highlightjs/ directory inside your Drupal root
● You can download the library from http://highlightjs.org and copy js
and styles folder from downloaded folder and place in
● D3.js is used when viewing the timeline page.
● You can download the library from
https://github.com/d3/d3/archive/v3.5.17.zip and place in
● Webprofiler module requires D3 library 3.x (not 4.x) to render data.
● For Web Profiler to display the details on the timeline page you must add the
following two lines to your settings.php or settings.local.php.
● This two lines will be also available in /devel/webprofiler/README.md.
$class_loader->addPsr4('Drupalwebprofiler', [ __DIR__ .
● Be aware that the code above assumes you’ll add the devel module at
Each class name discovered while profiling (controller class, event class) is
specially linked to open the class in an IDE. You can configure the URLs for
these links to work for your IDE.
● PhpStorm 8+