Updated on 16 January 2018

Effective development starts by knowing well the system capabilities, API's and the ecosystem, that will be described briefly below. One of the newcomer mistake is programming too much. If you need to implement a commonly used feature there are chances that there is a module for that.

Drupal has many satellite tools that will dramatically reduce the time needed for common programming tasks. The most used are exposed below. A complete list is available on the Development tools overview on Drupal.org.

Drupal is also pretty well integrated in the PHP galaxy (Symfony, Composer / Packagist, PSR's) since the version 8, so you can still find documentation outside of the Drupal scope.


Let's start by your most used tool!

A single reference here, even if Sublime and NetBeans are wonderful, nothing beats PHPStorm for a Drupal job.
Composer, Git, Vagrant, Xdebug, Drupal coding standards, REST support, Drupal indentation style and perfect autocompletion with inline documentation. It has also support for Symfony, Laravel, Blade, ...

PHPStorm logo

Pricing: 199 € the first year.

Drupal development using PHPStorm

Keyboard shortcuts for PHPStorm

Automation tools (CLI)

Drush, Drupal Console and Phing are coming out of the box in the vendor/bin directory after a Composer install of this fork of the Composer template for Drupal project. They are intended to be used locally, so you make sure that you are using the right version with the Drupal Core (e.g. Drush 9 with core 8.4.x).

So, if you start from this Composer template, you will not need to install them.

Several other tools are also shipped with this template so just have a look at the readme.


Drush stands for Drupal Shell, it is the command line and scripting interface for Drupal. You can use it to speed up installing, developing and maintaining Drupal sites.

A major change since version 7 is that is should not be installed globally but locally, per website.

Install modules, generate content, rebuild cache ... find everything on Drush Commands.

List of the drush commands: drush list, (or just drush) then to get some help drush help [command]

Some of the most used Drush commands, to be executed on the web/docroot directory :

  • drush cr - Cache rebuild (replaces the Drupal 7 drush cc all)
  • drush uli - User login: generates a one time login for
  • drush sql-dump - Creates a database dump
  • ...

Install Drush

Drush and Composer tips

Use Composer commands (composer install, composer require, ...) at the root of your project, where the composer.json file is located (so parent of the web / docroot / public_html, ... directory).

cd my_site/
composer install

Use Drush locally (and not globally) via the vendor directory but execute the command in the web directory.

cd my_site/web
../vendor/bin/drush cr

Drupal Console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.

Scaffold code, get controllers and services and much more, some of the commands :

  • drupal gm - Generates scaffold code for a module (generate:module)
  • drupal gpb - Generates a Block Plugin (generate:plugin:block)
  • drupal gcn - Generates a Controller (generate:controller)
  • drupal dco - Displays current services for an application (debug:container)

List all the Drupal Console commands: drupal list (or just drupal)

Install Drupal Console


If you find yourself writing custom scripts to handle the packaging, deploying, or testing of your applications, then we suggest looking at Phing. Pre-packaged with numerous out-of-the-box operation modules (tasks), and an easy-to-use OO model to extend or add your own custom tasks.

Some of the commands, to be executed on the parent directory of the web/docroot :

./vendor/bin/phing install - Installs the website (make sure that you have your the build.properties.local file)

./vendor/bin/phing setup-dev (after an installation, or if you want to couple the two : ./vendor/bin/phing install-dev)

This will perform the following tasks:

  1. Configure Behat.
  2. Configure PHP CodeSniffer.
  3. Enable 'development mode'. This will:
  • Enable the services in development.services.yml.
  • Show all error messages with backtrace information.
  • Disable CSS and JS aggregation.
  • Disable the render cache.
  • Allow test modules and themes to be installed.
  • Enable access to rebuild.php.
  1. Enable development modules.
  2. Create a demo user for each user role.

List the available Phing build commands : ./vendor/bin/phing

More about Phing


To dig your way out of the list commands, use grep: drupal list | grep service



Install your development environment

Drupal VM

Drupal VM makes building Drupal development environments quick and easy, and introduces developers to the wonderful world of Drupal development on virtual machines or Docker containers (instead of crufty old MAMP/WAMP-based development).

It will install the following on an Ubuntu 16.04 (by default) linux VM: Apache or Nginx, PHP7+, MySQL5+ and optionnaly Solr, Elasticsearch, Varnish, Selenium, Redis, MaiHog, ...

Install Drupal VM

PHP built in server

If you already have PHP and MySQL installed (not even Apache), you can still rely on the PHP built in server. Do not expect performances, but for fast tests it should do the trick if you do not want to vagrant provision / reload.

You should install manually solutions like MailHog or Mailcatcher to prevent sending mail to real users, Xdebug, ... or change your mind for DrupalVM.

Read more

MAMP (MacOSX), XAMPP (Windows and Unix)

Not a personal favourite, but could be used as a starting point if you are not familiar with the command line.

Configure your development environment

Most of the time, this command will do the trick

drupal site:mode dev

Drupal Console site:mode dev

Caching configuration

Drupal comes with great caching for production, but before you start development tasks, there is some configuration to prevent caching.

Disable Drupal 8 caching during development

Twig debugging

Displaying the Twig templates used by regions, blocks, nodes, ... is just one variable away in the development.services.yml.

debug: true

Then cache rebuild drush cr


Without Twig debug

After, with Twig debug enabled

With Twig debug enabled

This is described in deep + other Twig techniques on the following links from Drupal.org.

Test emails and prevent them to be sent to real users

The straightforward method is to use MailHog, configured by default on Drupal VM.
There are several other methods that are described on Drupal.org.

Debug and development modules

Devel, Devel Generate Kint and Webprofiler modules

Devel toolbar

They all come with the Devel module.

  • Devel - Helper functions for Drupal developers
  • Devel Generate - Accelerate development of your site or module by quickly generating nodes, comments, terms, users, and more. See also the Demo Content module below.
  • Kint - pretty print of variables with. kint($my_var)
  • Web Profiler - Port of the Symfony WebProfiler Bundle as a Drupal 8 module, do not use the standalone module, it is now part of the Devel module. Just FYI, see also the new 3.1 Symfony debug toolbar.

Read more

Admin Toolbar

Improves the the default Toolbar, comes with two modules: Admin Toolbar and Admin Toolbar Extras Tools.

Admin Toolbar

Examples for Developers

The Examples for Developers project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.

This module provides examples for Block, Cache, Config and Content Entity, Cron, Database API, Email, Events, Form API, Field, Field Permission, File, Hooks, Javascript, Node Type, Page, Pager, PHPUnit, Plugin Type, Queue, Simple Test, Stream Wrapper, Table Sort, Testing, Tour.

Demo content

The demo_content module lets you import demo content entities from YAML files. It has support for modules, profiles and themes. It can create and update any content entity types: nodes, blocks, files, images, taxonomy terms, menu links..etc.

See example module and theme: https://github.com/arshad/demo_content_examples

Configuration management

Configuration management (you can also find former references to the term CMI), will allow you to export your configuration (content type and vocabularies structure, modules settings, ...), but not the content. It is provided by the Drupal core.

In Drupal 7, it was the role of the Features module. In Drupal 8, you should avoid the Features module for that use case

In Drupal, configuration is the collection of admin settings that determine how the site functions, as opposed to the content of the site. Configuration will typically include things such as the site name, the content types and fields, taxonomy vocabularies, and so on.

You can use Drush for configuration export (drush cex) and import (drush cim) or the UI.
Configuration management is a vast topic, it will be covered on a dedicated post, but you can find plenty of good resources.

Just make sure that you use the 'config' storage directory outside of the files directory (default configuration that can be changed in sites/default/settings.php) so you can version it.

Here is a September 2017 presentation about the specific case of sharing and overriding configuration in a Drupal 8 multisite by Jan Lemmens.

Related modules

Coding Standards

PHP Code Sniffer

PHP Code Sniffer is a library that tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards. It works with Drupal 6, 7, or 8.

Check Drupal coding standards

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md /file/to/drupal/example_module

Automatically fix coding standards

phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md /file/to/drupal/example_module

PHP Standards Recommendations (PSR's)

The PHP Standard Recommendation is a PHP specification published by the PHP Framework Interop Group. Similar to Java Specification Request for Java, it serves the standardization of programming concepts in PHP. The aim is to enable interoperability of components and to provide a common technical basis for implementation of proven concepts for optimal programming and testing practices. The PHP-FIG is formed by several PHP frameworks founders.

Each PSR is suggested by members and voted according to an established protocol to act consistently and inline with their agreed upon processes.


PHP: The right way

There’s a lot of outdated information on the Web that leads new PHP users astray, propagating bad practices and insecure code. PHP: The Right Way is an easy-to-read, quick reference for PHP popular coding standards, links to authoritative tutorials around the Web and what the contributors consider to be best practices at the present time.



Drupal 8 testing

The ultimate guide to write tests for Drupal 8 modules, themes and profiles. It aims to provide sample code and methods to write different types of testings available in core.


Simple Test, PHP Unit and Behat

Pieter Frenssen provides great learning material about testing:


Blackfire empowers all developers and IT/Ops to continuously verify and improve their app’s
performance, throughout its lifecycle, by getting the right information at the right moment.



Heatmaps, Visitor Recordings, Conversion Funnels, Form Analytics, Feedback Polls and Surveys in one platform.



Submitted by Jo Wouters (not verified) on Sat, 11/18/2017 - 09:04


"API's" points to a non-existing url ( https://drupalship.org/drupal-api )

Submitted by Stas (not verified) on Tue, 01/30/2018 - 08:48


I prefer to use Codelobster for Drupal projects: http://www.codelobster.com/drupal.html

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Only images hosted on this site may be used in <img> tags.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.