CLI tool for running checks on a Drupal code base

Installs: 49 900

Dependents: 5

Suggesters: 0

Stars: 142

Watchers: 12

Forks: 26

Open Issues: 26



Built on PHPStan, this static analysis tool will check for correctness (e.g. using a class that doesn't exist), deprecation errors, and more.

Why? While there are many static analysis tools out there, none of them run with the Drupal context in mind. This allows checking contrib modules for deprecation errors thrown by core.

Are you ready for Drupal 9? Check out our Drupal 9 Readiness instructions for details on how this tool can help.

Don't want to run Drupal Check on your own? We offer a hosted version in Centarro Toolbox for folks who want it done for them.


  • PHP >=7.1


The easiest way to install is by downloading the latest PHAR and putting it into your path. For example:

curl -O -L
mv drupal-check.phar /usr/local/bin/drupal-check
chmod +x /usr/local/bin/drupal-check


You can install this in your project using Composer as a development dependency like so:

composer require mglaman/drupal-check --dev

You can also install this globally using Composer like so:

composer global require mglaman/drupal-check

Refer to Composer's documentation on how to ensure global binaries are in your PATH:

Note: you can also install this locally to your project and run it from that project's Composer bin directory.

Build From Source

Follow these instructions to build from source:


This tool works on all Drupal code, but must be executed within the root directory of a Drupal project..

1. cd into a Drupal Directory

You can run this tool within any Drupal project. But, for best results, create a fresh Drupal directory on the latest Drupal:

composer create-project drupal-composer/drupal-project:8.x-dev drupal --no-interaction --stability=dev
cd drupal

2. Run drupal-check


drupal-check [OPTIONS] [DIRS]


  • OPTIONS - See "Options" for allowed values. Specify multiples in sequence, e.g. -ad.
  • DIRS - One or more directories within the root of a Drupal project.


  • -a Check analysis
  • -d Check deprecations (default)
  • --drupal-root Path to Drupal root. Fallback option if drupal-check could not identify Drupal root from the provided path(s).


  • Check the address contrib module:

    drupal-check web/modules/contrib/address
  • Check the address contrib module for deprecations:

    drupal-check -d web/modules/contrib/address
  • Check the address contrib module for analysis:

    drupal-check -a web/modules/contrib/address
  • Check the address contrib module for both deprecations and analysis:

    drupal-check -ad web/modules/contrib/address

Drupal Check - VS Code Extension

You can run Drupal Check from VSCode using this extension:

The code can be found at:


GPL v2


See what feature requests are most popular in the Issue queue:


Submit issues and feature requests here:

Known Issues

There are conflicts with dependencies shared with other libraries that might be installed on a Drupal project:


See the