Devel for Drupal 8

Preview:

Citation preview

DEVEL D8 - Release party

INTRODUCTION

ABOUT ME

➤ Luca Lusso

➤ Senior software architect at Wellnet - Italy

➤ Teacher for www.corsidrupal.it

➤ (co-)mantainer of Devel, Vardumper, Monolog, XHProf, …

➤ @lussoluca on Twitter

➤ lussoluca on drupal.org

DEVEL

Devel module turns 8!The project began in 2003. At that time Drupal version was 4.1

Now it has reached more that 3.500.000 downloads and it runs on more than 200.000 websites.

The actual Drupal 8 version is 1.0-RC1, the next will be the 1.0 stable!

DEVEL USAGE

MAINTAINERS

DEVEL

We’ll release the first stable version very soon!So let’s see the new shiny features of Devel for Drupal 8.

INCLUDED SUB-MODULES

NEW SUB-MODULES

➤ kint

➤ webprofiler

REMOVED SUB-MODULES

Devel Node Access -> now in it’s own module at https://www.drupal.org/dna waiting for a full release for D8. Then it will be added back to Devel.

CORE INTEGRATIONS

CORE INTEGRATIONS

Drupal 8 integrates a lot of modules that in Drupal 7 were contrib.

The new Devel leverages those modules to provide information and new features to developers.

TOOLBAR

TOOLBAR

➤ Devel is now directly integrated into the core Toolbar module

➤ Visible links are configurable

➤ When in vertical mode the Toolbar shows links to all the available features

SERVICES, ROUTING AND EVENTS

Drupal 8 adds a lot of new concepts and structures that developers needs to understand in order to build new modules.

Devel now provides report pages for services, routing, events and many more.

SERVICES, ROUTING AND EVENTS

SERVICES, ROUTING AND EVENTS

SERVICES, ROUTING AND EVENTS

MANAGE CONFIGURATION AND STATE

Goodby Variables API, welcome Configuration Management System and State API!

You can use Devel to inspect and edit both systems.

MANAGE CONFIGURATION AND STATE

MANAGE CONFIGURATION AND STATE

ALL FEATURES➤ Cache clear ➤ Config editor ➤ Container Info ➤ Current route info ➤ Element Info ➤ Entity Info ➤ Events Info ➤ Execute PHP ➤ Field Info ➤ PHPinfo() ➤ Rebuild Menu ➤ Reinstall Modules • Routes Info ➤ Run cron ➤ State editor ➤ Theme registry ➤ View Session

SWITCH USERS

As in Drupal 7, Devel provides a block that allows a quick switch between users.

SWITCH USERS

TWIG EXTENSIONS

The Twig engine in core allows module developers to add new functions and filters to be used in templates (http://twig.sensiolabs.org/doc/2.x/advanced.html).

Devel adds three new Twig functions for template developers:

➤ devel_dump($var)

➤ devel_message($var)

➤ devel_breakpoint()

DEVEL_DUMP

Prints a complex data structure in a pretty way, the same as PHP function kpr().

Without arguments devel_dump display the full Twig context.

DEVEL_DUMP

DEVEL_MESSAGE

Prints a complex data structure in a pretty way in the message area, the same as PHP function dpm().

Without arguments devel_message display the full Twig context.

DEVEL_MESSAGE

DEVEL_BREAKPOINT

Forces the PHP interpreter to stop the same way as setting a breakpoint in an IDE.

Available variables are in $context array. Actually it works only with xDebug.

DEVEL_BREAKPOINT

Quick live demo

DUMPERS

DUMPERS

Devel now provides a way to replace the tool used for formatting and displaying the variables inspected through the debug functions.

Dumpers are implemented using the new plugin system in core.

Some of these plugins require external libraries for to be enabled. Those libraries have to be installed with Composer.

AVAILABLE DUMPERS

Doctrine debug (the default one)

uses Doctrine\Common\Persistence\Proxy\Debug class

Drupal variable

uses Drupal\Component\Utility\Variable class

Symfony var-dumper

uses Symfony\Component\VarDumper\Dumper\HtmlDumper class

ChromePHP

uses the ChromePhp debugging tool

FirePHP

uses the FirePhp debugging tool

Kint (in a sub-module, needs to be enabled)

uses Drupal\kint\Plugin\Devel\Dumper\Kint class

DOCTRINE DEBUG

DRUPAL VARIABLE

SYMFONY VAR-DUMPER

SYMFONY VAR-DUMPER

If vardumper module is present and enabled the class used by the dumper became:

Drupal\vardumper\Plugin\Devel\Dumper\VarDumper

which provides more integration with Drupal data structures:

➤ class names becomes links to the relative class in IDE (if configured)

➤ user roles becomes link the role edit page

➤ more to come…

KINT

ADD A DUMPER

Dumpers are plugins, contrib modules can add new dumpers to the system:

ExampleDumper.php has to be in the Plugin\Devel\Dumper\namespace

ADD A DUMPER

Every dumpers needs to implement the DevelDumperInterface interface, or extend the DevelDumperBase class:

WEBPROFILER

WEBPROFILER

The old Devel query logger and memory profiler has been removed in favour of a new sub-module: Webprofiler

REALTIME DATA

The report pages that Devel shows about services, routing and so on, lists all data available in a Drupal website.

Webprofiler instead collects data about the rendered page, so it is useful to measure performance data and to debug every single response.

AVAILABLE DATA COLLECTORS - 1

➤ Assets

➤ Blocks

➤ Cache

➤ Config

➤ Database

➤ Devel

➤ Events

➤ Extensions

➤ Forms

➤ Http

➤ Mail

AVAILABLE DATA COLLECTORS - 2

➤ PHP Config

➤ Performance Timing

➤ Request

➤ Routing

➤ Services

➤ State

➤ Theme

➤ Timeline

➤ User

➤ Views

WEBPROFILER

Quick live demo

INTEGRATION WITH XHPROF

Webprofiler collects high level Drupal data structure. If we need PHP function level data we need a hierarchical profiler like XHProf (or Tideways for PHP > 7.x)

The Drupal XHProf module adds a new data collector for Webprofiler

CALL FOR VOLUNTEERS

Do you want to contribute to Devel? We need help for development, testing, documentation, UX.

What are you waiting for? Contact us!

Recommended