Devel
Devel is a contributed Drupal module of debugging tools that developers install to inspect code and site internals while they build.
Devel (drupal/devel) is a set of helper functions, blocks and pages for Drupal developers and curious administrators. It prints variables and database queries on screen, lists internals such as services, routes and events, and lets you switch to another user account. Its Devel Generate submodule fills a site with dummy content. The main module in release 5.5.0 supports Drupal 10.3, 11 and 12.
How Devel works in Drupal 11
Install it with Composer (composer require 'drupal/devel:^5.5') and enable it. Version 5.5 needs PHP 8.3 or later and cannot be installed next to Drush older than 13.7. It defines two restricted permissions: access devel information for the debug pages and switch users for logging in as someone else with one click.
The debug functions live in devel.module. dpm() prints a variable in the message area, dsm() is an alias kept for history, dpq() prints the SQL of a database query, and ddebug_backtrace() prints a backtrace.
The info pages are routes under /devel:
/devel/container/serviceand/devel/container/parameterlist the registered services and parameters./devel/routeslists the routes, and/devel/eventslists event listeners./devel/entity/infodescribes entity types, and/devel/stateshows the State system./devel/switch-useris the Switch user page.
Settings are at /admin/config/development/devel. A mail-system class can write outgoing email to files instead of sending it. The Drush commands include fn-hook, fn-event, token, uuid and devel-services.
Devel Generate
The submodule creates sample content for development and testing. The Drush command devel-generate:content (alias genc) takes the number of nodes, 50 by default, and a --bundles option that defaults to page,article.
Example
To see what a form array holds, add this line to a form alter hook, reload the page and read the message area:
dpm($form);
To fill a development copy with 25 articles:
drush devel-generate:content 25 --bundles=article
Common mistakes
- Running
--killon the wrong site. The option deletes all content before generating new content. Check which site Drush points at first. - Granting
switch usersto a non-developer role. Its holder can become any user on the site with one click, administrators included.
For marketing and content teams
You will meet Devel when a developer asks to test with a copy of the site filled with dummy articles, or when a staging site shows a block for switching to another user, so the team can see pages as an editor or a visitor would. Both belong on a development site or a staging site. Ask which environments have Devel enabled and which roles hold its permissions.