lucacracco/project-starterkit

Project template custom for Drupal

Maintainers

Package info

github.com/lucacracco/project-starterkit

Homepage

Chat

Documentation

Type:project

pkg:composer/lucacracco/project-starterkit

Transparency log

Statistics

Installs: 78

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

dev-drupal-11.3.x 2026-08-11 18:04 UTC

This package is auto-updated.

Last update: 2026-08-11 18:04:29 UTC


README

Custom project template for Drupal 11 with DDEV.

Drupal PHP MariaDB DDEV

Prerequisites

Tool Version
DDEV >= 1.24
Docker latest
Composer >= 2.7
Git >= 2.30

Installation

New project

composer create-project lucacracco/project-starterkit:dev-drupal-11.3.x my-folder

Clone

git clone git@github.com:lucacracco/project-starterkit.git
cd project-starterkit

Start DDEV environment

ddev start

The environment is accessible at https://project-starterkit.ddev.site.

You can override config.yaml with additional config.*.yaml files.

Install Drupal

Install Composer dependencies:

composer install --prefer-dist

Fresh installation:

robo scaffold
robo install standard

Installation from database dump (.sql):

robo scaffold
robo install:database [path-to-dump.sql]

Update

After pulling from the repository:

composer install --prefer-dist
robo scaffold
robo deploy

Project Structure

.
├── .ddev/                  # DDEV configuration
├── config/                 # Exported Drupal configuration
├── private/                # Private files and logs
├── recipes/                # Drupal recipes
├── web/                    # Document root
│   ├── core/               # Drupal core
│   ├── modules/contrib/    # Contributed modules
│   ├── modules/custom/     # Custom modules
│   ├── profiles/custom/    # Custom profiles
│   ├── themes/contrib/     # Contributed themes
│   └── themes/custom/      # Custom themes
├── composer.json
├── RoboFile.php            # Custom task runner
└── .phpqa.yml              # PHPQA configuration

Main Commands

Development

Command Description
robo scaffold Prepares structure and folders
robo deploy Runs post-deploy updates
robo config:export Exports Drupal configuration
robo config:import Imports Drupal configuration

Code Quality

Command Description
vendor/bin/robo phpqa Runs phpcs, phpstan, security-checker, phpmetrics
vendor/bin/robo phpqa --path=web/modules/custom/my_module Analysis on specific module
vendor/bin/robo phpqa --tools=phpstan,phpcs Analysis with specific tools

Testing

Command Description
vendor/bin/robo phpunit Runs PHPUnit tests
vendor/bin/robo nightwatch Runs Nightwatch tests (JS)
vendor/bin/robo nightwatch --tag=module_name Nightwatch tests filtered by tag
vendor/bin/robo behat Runs Behat tests (BDD)
vendor/bin/robo behat --tags=@my_module Behat tests filtered by tag
vendor/bin/robo playwright Runs Playwright tests (E2E, all browsers)
vendor/bin/robo playwright --project=chromium Playwright tests on specific browser
vendor/bin/robo playwright --headed Playwright tests in headed mode

Utilities

Command Description
composer nuke Removes vendor and reinstalls dependencies
drush cr Clears Drupal cache
drush updatedb Runs database updates
ddev xdebug on Enables Xdebug (disable with ddev xdebug off)

Behat — BDD Testing

Behat enables writing acceptance tests in a readable, business-friendly format using Gherkin syntax.

Setup

After starting DDEV, Behat is ready to use. Configuration is in behat.yml at the project root.

Running Tests

# Run all Behat tests
vendor/bin/robo behat

# Filter by tag
vendor/bin/robo behat --tags=@my_module

# Run specific suite
vendor/bin/robo behat --suite=default

File Structure

  • Features: tests/behat/features/ — Gherkin scenario files
  • Contexts: tests/behat/bootstrap/FeatureContext.php — step definitions
  • Config: behat.yml — Behat configuration

Playwright — E2E Testing

Playwright provides end-to-end testing with multi-browser support (Chromium, Firefox, WebKit), visual testing capabilities, and HTML reports.

Setup

After starting DDEV, install Playwright dependencies and browsers:

# Install Node.js dependencies
ddev exec -d /var/www/html/tests/playwright npm install

# Install Playwright browsers (Chromium, Firefox, WebKit)
ddev exec -d /var/www/html/tests/playwright npx playwright install --with-deps chromium firefox webkit

Note: Browsers are installed in the DDEV container. After ddev restart, you may need to reinstall browsers.

Persistent setup (optional)

To avoid reinstalling browsers after every ddev restart, create the file .ddev/web-build/Dockerfile.playwright with the following content:

# Playwright dependencies installation
# This Dockerfile is automatically used by DDEV when building the web container image

# Install system dependencies required by Playwright browsers
RUN apt-get update && apt-get install -y \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libxkbcommon0 \
    libxcomposite1 \
    libxdamage1 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libpango-1.0-0 \
    libcairo2 \
    libasound2 \
    libxcursor1 \
    libgtk-3-0 \
    libcairo-gobject2 \
    libgdk-pixbuf-2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Copy Playwright package files
COPY tests/playwright/package.json /var/www/html/tests/playwright/
COPY tests/playwright/package-lock.json* /var/www/html/tests/playwright/

# Install Node.js dependencies
RUN cd /var/www/html/tests/playwright && npm ci

# Install Playwright browsers
RUN npx playwright install chromium firefox webkit

Then rebuild the DDEV image:

ddev debug rebuild

The Playwright browsers will be baked into the container image and persist across restarts.

Running Tests

# Run all tests on all browsers (headless)
vendor/bin/robo playwright

# Run tests on a specific browser
vendor/bin/robo playwright --project=chromium
vendor/bin/robo playwright --project=firefox
vendor/bin/robo playwright --project=webkit

# Run tests in headed mode (for debugging)
vendor/bin/robo playwright --headed

Test Reports

After running tests, the HTML report is generated at:

tests/playwright/playwright-report/

Open tests/playwright/playwright-report/index.html in a browser to view the report.

File Structure

  • Tests: tests/playwright/tests/ — Playwright test files (.spec.ts)
  • Config: tests/playwright/playwright.config.ts — Playwright configuration
  • Report: tests/playwright/playwright-report/ — HTML test reports (generated)

Configuration

The PLAYWRIGHT_BASE_URL environment variable is automatically set via DDEV configuration (.ddev/config.yaml) using ${DDEV_PRIMARY_URL}. This allows the same configuration to work across different DDEV projects.

Included Tools

Production

  • Drupal 11.3.x
  • Drush 13+
  • Config Split — per-environment configuration management
  • Environment Indicator — visual environment indicator
  • Monolog — structured logging
  • Redis — Redis cache support

Development

  • Devel — debugging tools
  • Webprofiler — integrated profiler
  • PHPQA — code quality suite (phpcs, phpstan, phpmd, security-checker, phpmetrics)
  • PHPUnit — unit and functional tests
  • Nightwatch — JavaScript end-to-end tests
  • Behat — BDD acceptance tests with readable scenarios
  • Playwright — end-to-end tests with multi-browser support (Chromium, Firefox, WebKit)

DDEV — Useful Commands

ddev start                # Start environment
ddev stop                 # Stop environment
ddev restart              # Restart environment
ddev ssh                  # Access web container
ddev exec <command>       # Run command in container
ddev logs                 # View logs
ddev describe             # Show environment details
ddev launch               # Open site in browser
ddev snapshot             # Create database snapshot
ddev import-db            # Import database from file
ddev export-db            # Export database

FAQ

How do I manage configuration per environment?
Use config_split to separate configuration by environment (dev, stage, prod). Export with robo config:export.

How do I enable Xdebug?

ddev xdebug on
# To disable:
ddev xdebug off

How do I import an existing database?

ddev import-db --file=path/to/dump.sql
robo scaffold
robo deploy