
Aljibe is a DDEV add-on for Drupal projects that adds several tools quickly and easily, leaving a new project ready for development in a few minutes.
Aljibe extends DDEV by adding containers, configuration, and commands to make the development of Drupal projects faster and easier.
See Aljibe: quality and testing for Drupal development with DDEV for a detailed introduction to Aljibe.
Note: This tool is based on DDEV, so any DDEV add-on can work with Aljibe. Discover available add-ons with
ddev add-on listfor official DDEV add-ons orddev add-on list --allfor all available add-ons.
New to Aljibe? Follow these steps to get started
Create your project folder
mkdir my-new-project && cd my-new-project
Initialise DDEV in this folder
ddev config --auto
Install Aljibe
ddev add-on get metadrop/ddev-aljibe
Run the assistant
ddev aljibe-assistant
The assistant will guide you through the installation and configuration of the tools provided by Aljibe, as well as the Drupal site installation. Once complete, your project will be ready for development with all Aljibe tools provided working out of the box.
For detailed instructions, see Installation below.
Aljibe deploys folder structure and configuration files that follow Drupal best practices.
Folders:
config: contains exported Drupal site configuration.drush: contains Drush commands, configuration and site aliases.patches: contains patches applied to Composer dependencies. It is recommended to download patches and commit them locally. This folder is intended for storing those downloaded patches.private-files: contains private files for Drupal sites. Private files should not be stored in the web root for security reasons, so this folder is outside the web root.recipes: contains recipes for this project. Although recipes can be distributed as standard PHP packages, you can store project-specific recipes here that are not intended to be shared.scripts: custom scripts for your project can be stored here.Aljibe provides several static code analysis tools and linters to help maintain high code quality.
Because many tools are available, Aljibe uses two wrappers to manage them: GrumPHP and PHPQA.
GrumPHP runs automatically on each Git commit, while PHPQA is intended to be run manually or by your CI/CD system. Because both use the same underlying tools, they are configured similarly to ensure consistent results. Be sure to modify both configurations if you want to change the behaviour of any tool.
GrumPHP runs code quality checks automatically on each Git commit. Aljibe configures GrumPHP with several tools and checks by default, including Git message check, Git branch name, file sizes, PHPStan, PHP_CodeSniffer with Drupal standards, PHPMD, and various linters.
To customise it, refer to your project’s .grumphp.yml file. This file is provided by Aljibe during installation, but you can modify it to suit your project’s needs.
PHPQA is a wrapper that allows you to run multiple PHP static analysis tools with a single command. Aljibe configures PHPQA to run the following tools by default: PHP_CodeSniffer with Drupal standards, PHPMD and PHP Parallel Lint.
PHPQA is intended to be run manually or by your CI/CD system.
To customise it, refer to your project’s .phpqa.xml file. This file is provided by Aljibe during installation, but you can modify it to suit your project’s needs.
Behat is a Behaviour-Driven Development (BDD) framework for PHP. Aljibe includes Behat testing capabilities out of the box, allowing you to write and run acceptance tests for your Drupal site.
Behat is integrated with Drupal thanks to Drupal Extension.
Aljibe includes two Behat test environments: local and pro (production). You can add more environments by creating additional folders inside tests/behat/.
local: for local and CI/CD tests. This environment uses the DDEV local instance.pro: for production environment testing (usually smoke tests). This environment is intended to run tests against the live production site. Behat tests in this environment should be non-destructive and safe to run against a live site.  They should be short and not intensive, focusing on critical functionality to ensure the site is operational.The tests/common folder contains shared features that are run on all environments.
All provided Behat features (test scenarios) should pass after Aljibe is installed. Look for files with the .example extension inside tests/behat/ folders. These features usually require some Drupal modules or configuration and are not included by default to avoid having tests failing out of the box. If you want them, remove the .example extension and adapt them to your project.
Use the provided DDEV command to run tests from the default environment (local ) with default options:
ddev behat
You can specify a different environment by providing the folder name in the tests/behat/ directory. For example, to run the smoke tests in the pro environment:
ddev behat pro
If you want to provide additional options to Behat you need to add them after the environment name, which is mandatory. For example, to run tests with a specific tag:
ddev behat local --tags=@mytag
See Behat Command Line Tool for more information.
Note that the behat command already includes the path to the configuration file
Behat contexts are PHP classes that define the steps used in Behat features. Aljibe provides several additional contexts out of the box to facilitate testing common Drupal functionalities. Please check nuvoleweb/drupal-behat and metadrop/behat-contexts for more information about the provided contexts and how to use them.
BackstopJS is a tool for visual regression testing. Aljibe includes BackstopJS integration to help you catch visual changes in your Drupal site.
Aljibe provides two BackstopJS environments by default: local and pro (production). You can add more environments by creating additional folders inside tests/backstopjs/.
local: for local and CI/CD tests. This environment is the one provided by DDEV.pro: for production environment testing (usually smoke tests). This environment is intended to run tests against the live production site. BackstopJS tests in this environment should fast and not intensive, focusing on critical pages to ensure the site is visually correct.Each environment has its own backstop.json configuration file where the scenarios and settings are defined. For example, the URLs to test are defined here.
BackstopJS requires reference screenshots to compare the current state of the site against. These reference screenshots should be created when the site is in a known good state.
To create the reference screenshots use the reference command.
ddev backstopjs [environment] reference
Later, to test the site against the reference screenshots, use the test command.
ddev backstopjs [environment] test
Check BackstopJS documentation for more information about available commands and options.
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
Pa11y is an automated accessibility testing tool. Aljibe includes Pa11y integration to help you ensure your Drupal site meets accessibility standards.
To get a report of accessibility issues on your site, run the following command:
ddev pa11y [site_url]
Pa11y configuration file can be found at tests/pa11y/config.json.
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
Testing API and HTTP responses can be done using Newman, the command-line companion for Postman. Aljibe optionally includes Newman integration to facilitate API testing.
You can test HTTP response codes on URLs or endpoints, check HTTP headers and validate JSON responses against schemas using Postman collections.
To run a Postman collection with Newman, use the following command:
ddev newman run <collection file> -e <environment file>
Example provided by Aljibe after installation:
ddev newman run postman/collections/example_cache_headers.postman_collection.json -e postman/envs/example_ddev.postman_environment.json
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
Unlighthouse is a tool for auditing website quality, performance, SEO, and accessibility. It uses Lighthouse under the hood to perform these audits.
Aljibe includes Unlighthouse integration to help you maintain high-quality websites.
Unlighthouse can autodiscover site URLs and follow a sitemap.
To run it against your local site, use the following command:
ddev unlighthouse
This command uses the Unlighthouse configuration file located at tests/unlighthouse/local/unlighthouse.ts.
You can add more environments by creating additional folders inside tests/unlighthouse/.
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
Smoke tests are a set of basic tests that verify the critical functionality of a website.
Aljibe allows you to run smoke tests against production environments using the provided testing tools: Behat, BackstopJS, Pa11y, Newman and Unlighthouse.
Aljibe provides a ready-to-use Adminer installation for database management.
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
MkDocs is a static site generator that’s geared towards project documentation. Aljibe provides an MkDocs installation with MkDocs Material, a popular theme for MkDocs that provides additional functionality and a modern look.
You can find the main configuration file at docs/mkdocs.yml and the documentation content inside the docs/docs/ folder.
Aljibe already provides a boilerplate documentation structure that you can modify to suit your project’s needs.
Check MkDocs and MkDocs Material documentation for more information on how to create and manage your documentation.
This feature is provided by a separate DDEV add-on that is automatically installed when you install run Aljibe assistant and select this feature.
Many Drupal themes require a compilation process relying on Node.js, like Radix or Artisan themes. Aljibe provides commands to facilitate the processing of theme assets.
To generate production assets for a theme, run:
ddev frontend production [theme_name]
Where theme_name is the key defined in .ddev/aljibe.yml. If omitted, the command processes all defined themes.
After installation, there is one example theme defined in .ddev/aljibe.yml with the name “custom_theme”. You can add multiple themes.
Aljibe aims to ease site management tasks with several provided commands.
First, Aljibe makes it easy to install a site from a known base to start development. The command site-install installs a site using either a configuration export or a database dump.
During development, it is common to configure the local site with a known setup for testing and development. Many times this is done using a database dump from a staging or production server.
Another option is to use a configuration export to set up the site, and use default content to populate the site with content to be able to test functionalities. This is the recommended way when working with Drupal projects that have a complete configuration management workflow, because it allows predictable setup times, avoid any privacy issues with real data (no need for sanitisation) and is usually faster than importing a database dump.
To install the default site from the configuration export, run:
ddev site-install
For this to work, a Drupal configuration export must be available. The command uses Drush commands (sql-drop, site:install and config-import) to perform the installation from existing configuration.
To install a different site other than the default, use its site name:
ddev site-install <site_name>
Where site_name is the site alias defined in your Drush aliases, or just the name without dots (in this case, .local will be appended automatically) for local sites:
ddev site-install site1   # Installs @site1.local
ddev site-install site2.mylocal  # Installs @site2.mylocal
Run the following command to install a site from a database dump:
ddev site-install site1 path/to/dump.sql   # Installs @site1.local using the provided database dump
In this case, the site name is mandatory, as well as the path to the database dump file.
The setup commands allow for fast on-boarding of new developers by automating the site installation process. A new developer only needs to clone the project repository and run ddev setup to have a working local site ready for development.
The setup command installs Composer dependencies and installs the site (or sites in a multisite setup) using site-install.
This command currently supports only installation from configuration exports.
Both commands, setup and site-install, provide hooks to allow you to run custom commands at different stages of the process. This is useful for performing additional setup tasks if your project requires special steps.
Check hooks configuration property of .ddev/aljibe.yml file for more information about available hooks and how to use them.
Aljibe supports multisite setups using Drush aliases. Some commands allow you to select the site using Drush aliases, while others require you to provide the appropriate configuration.
For example, use different Behat profiles for different sites, or provide absolute URLs to BackstopJS or Pa11y commands, or use the site name in the site-install command.
Some commands are provided to ease certain operations:
ddev all-sites-drush: run a Drush command on all sites in the multisite installation.ddev create-database: create secondary databases. This is useful if your site requires another database, or when you are adding a new site to your project and you need to create its database.Drupal Updater is a tool to update Drupal core and contributed modules automatically. Aljibe includes Drupal Updater integration to help you keep your Drupal installation up to date.
This PHP package is able to update each module or theme in separate commits, update Drupal configuration and even update the Drupal core itself. It relies on Composer to perform the updates.
Read more about Drupal Updater in this article: Drupal Updater: Streamlining Drupal Maintenance Updates from CLI.
Use the following command to run it:
ddev exec vendor/bin/drupal-updater
When deploying a Drupal site, it is often recommended to create artefacts that can be deployed to the production server. These artefacts include only the necessary files for the site to run, excluding development dependencies and unnecessary files.
Aljibe includes Drupal Artefact Builder, a tool to create Drupal artefacts for deployments from the current state of the codebase.
Use the following command to run it:
ddev exec vendor/bin/drupal-artifact-builder
To transform an existing project to use DDEV Aljibe, follow these steps. Always take into account the particularities of your specific project:
ddev config --auto
ddev get metadrop/ddev-aljibe
ddev config
Set the project type to Drupal, specify the docroot folder, etc.
.ddev/config.yml to fine-tune the environment.ddev/aljibe.yml to set the default site name (the folder inside sites/) and all themes to be compiled.gitignore to match this exampleIf you’re migrating from a Metadrop boilerplate project:
settings.ddev.php)tests/ folder structure (in Aljibe, all tests including behat.yml are inside the tests/ folder)http://apache or http://nginx with http://web in all test configurationsnodejs_version in .ddev/config.yml to match your previous project.env file under the “NODE_TAG” variableEXEC_GRUMPHP_COMMAND in grumphp.yml to "ddev exec"ddev setupddev setup --allddev setup --sites=site1The aljibe.yml file allows you to customise various aspects of the Aljibe setup. This file is located at .ddev/aljibe.yml and is created automatically when you install Aljibe.
default_siteSets the default site name to be installed by the setup command when no specific site name is provided.
Example:
default_site: my_site
With this configuration:
ddev setup will install the site “my_site”ddev setup my_siteNote: Site names must match drush aliases. Names without dots are automatically considered as “.local” aliases. If you have a different alias suffix, you can specify it explicitly and “.local” will not be appended.
theme_pathsDefines paths to custom themes that work with the ddev frontend command. Each theme should be listed with a unique key that you’ll use when running frontend commands.
Example:
theme_paths:
  custom_theme: /var/www/html/web/themes/custom/custom_theme
  admin_theme: /var/www/html/web/themes/custom/admin_theme
Usage:
ddev frontend production custom_theme  # Build production assets for custom_theme
ddev frontend watch admin_theme        # Watch mode for admin_theme
hooksHooks are commands that execute at different stages of the setup process. They are defined as lists of commands under various hook points, allowing you to customise the workflow to your project’s needs.
Available hooks:
Setup hooks:
pre_setup: Commands to run before the setup processpost_setup: Commands to run after the setup processSite installation hooks:
pre_site_install: Commands to run before any type of site installationpost_site_install: Commands to run after any type of site installationpre_site_install_config: Commands to run before site installation from configurationpost_site_install_config: Commands to run after site installation from configurationpre_site_install_db: Commands to run before site installation from database dumppost_site_install_db: Commands to run after site installation from database dumpExample configuration:
hooks:
  pre_setup:
    - echo "Aljibe pre setup hook"
    - ddev snapshot
  post_setup:
    - echo "Aljibe post setup hook"
    - ddev drush uli --uid=2
  pre_site_install: []
  post_site_install:
    - ddev @${SITE_ALIAS} drush cr
  pre_site_install_config: []
  post_site_install_config: []
  pre_site_install_db: []
  post_site_install_db: []
Available variables in hooks:
Site installation hooks (pre_site_install, post_site_install, etc.):
DRUPAL_PROFILE: The profile used to install the siteSITE_PATH: The path to the site relative to web/sitesSITE_ALIAS: The drush alias of the site (without the @ prefix)Setup hooks (pre_setup, post_setup):
NO_THEMES: Set if --no-themes flag was usedNO_INSTALL: Set if --no-install flag was usedSITES: The sites to be installedCONFIG_DEFAULT_SITE: The default site configuredAll DDEV environment variables are also available in all hooks.
installable_sites_aliasesDefines the list of sites to install when running ddev setup --all. Additional sites can still be installed later using the ddev site-install <site_name> command.
Example:
installable_sites_aliases:
  - site1
  - site2
  - site3.mylocal
Note: Site names must match drush aliases. Names without dots are automatically considered as “.local” aliases. If you have a different alias suffix, you can specify it explicitly and “.local” will not be appended.
You can add any custom configuration you need to the aljibe.yml file. This configuration can be retrieved programmatically with the ddev aljibe-config command, which is useful for scripting and automation.
Example commands:
Get all theme paths:
ddev aljibe-config theme_paths
Get the default site:
ddev aljibe-config default_site
Get any custom configuration key:
ddev aljibe-config my_custom_key
Common issues and their solutions.
HTTPS requires proper SSL certificate configuration on your system.
Solution:
mkcert and libnss3-toolsmkcert -install
Due to NetBeans issue #7562, you need to manually configure Xdebug for NetBeans.
Solution:
Create a file named xdebug.ini in .ddev/php/ with the following content:
[XDebug]
xdebug.idekey = netbeans-xdebug
Note: netbeans-xdebug is the default Session ID value in the Debugging tab of NetBeans’ PHP configuration dialogue. If you’ve changed it, update the xdebug.ini file accordingly.
If Xdebug profiling files aren’t being generated, you need to configure the profiler output directory.
Solution:
Follow the DDEV Xdebug profiling documentation and create a file named xdebug.ini in .ddev/php/ with:
[XDebug]
xdebug.mode=profile
xdebug.start_with_request=yes
# Set a DDEV shared folder for the xprofile reports
xdebug.output_dir=/var/www/html/tmp/xprofile
xdebug.profiler_output_name=trace.%c%p%r%u.out
Verification:
ddev xdebug on/admin/reports/status/php (Drupal) to verify Xdebug variables are configured correctly