PHPackages                             wunderio/ddev-drupal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. wunderio/ddev-drupal

ActiveComposer-plugin

wunderio/ddev-drupal
====================

Wunder's extendable template for DDEV Drupal projects.

0.6.2(6mo ago)06.0k↓50%[11 issues](https://github.com/wunderio/ddev-drupal/issues)[1 PRs](https://github.com/wunderio/ddev-drupal/pulls)GPL-2.0-or-laterPHP

Since Dec 13Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/wunderio/ddev-drupal)[ Packagist](https://packagist.org/packages/wunderio/ddev-drupal)[ Docs](https://github.com/wunderio/ddev-drupal)[ RSS](/packages/wunderio-ddev-drupal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (36)Used By (0)

Wunder template for DDEV Drupal projects
========================================

[](#wunder-template-for-ddev-drupal-projects)

This project extends the standard [DDEV](https://ddev.com/) setup with additional functionality and tools specifically designed for Drupal development. It provides a set of custom commands, configurations, and automation scripts to enhance your Drupal development workflow.

Features
--------

[](#features)

### Custom DDEV Commands

[](#custom-ddev-commands)

- `pmu`: Runs drush pmu commands and creates dummy module folders if they don't exist. This helps to uninstall module that has gone missing for example during branch switching. ```
    ddev pmu module1 module2 ...
    ```
- `twig-debug`: Toggles Drupal Twig debugging on/off. Useful for template development. ```
    ddev twig-debug        # Enable Twig debugging
    ddev twig-debug off    # Disable Twig debugging
    ```
- `grumphp`: Runs GrumPHP commands ```
    ddev grumphp
    ```
- `phpunit`: Runs PHPUnit commands ```
    ddev phpunit
    ```
- `codecept`: Runs codeception commands ```
    ddev codecept
    ```
- `phpcbf`: Runs phpcbf commands ```
    ddev phpcbf
    ```
- `phpcs`: Runs PHPcs commands ```
    ddev phpcs
    ```
- `regenerate-phpunit-config`: Regenerates fresh PHPUnit configuration ```
    ddev regenerate-phpunit-config
    ```
- `syncdb`: Synchronizes local database with production. For production you should have a prod alias set in drush/sites/self.site.yml ```
    ddev syncdb
    ```
- `yq`: Runs [yq](https://mikefarah.gitbook.io/yq) commands (YAML processor) It's available inside DDEV, but we expose it to host because why not :). It's required in syncdb script, but it could prove useful in day to day work. ```
    ddev yq
    ```

### Enhanced Configuration

[](#enhanced-configuration)

1. **Custom DDEV Configuration**

    - Post-start scripts for both host and web containers - by default it gives you uli link.
    - Automatic update checks for this package
2. **Performance Optimizations**

    - Special `database_dumps/` directory for Mac users not to mount db dumps

### Automated Workflows

[](#automated-workflows)

The project includes several automated workflows:

1. **Database Management**

    - Post-import database hooks (clears cache, sanitizes database)
    - Post-restore snapshot hooks (clears cache, sanitizes database)
    - Database synchronization from production
2. **Development Environment Setup**

    - Automatic composer installation on first start
    - Post-start hook that run drush uli
    - Integration with Wunderio's development tools eg grumphp, phpunit

Both custom commands and hooks are scripts under `dist/.ddev/wunderio/core/` folder and you can extend them if you copy particular script to `dist/.ddev/wunderio/custom/`. This folder is never overwritten during autoupdate.

Requirements
------------

[](#requirements)

- [DDEV](https://ddev.com/)

Installation
------------

[](#installation)

1. Initialize your Drupal 10 project. Project name parameter is optional, but it's advisable to use domain name as your project name as that's used for for the subdomain of ddev.site eg if project name is example.com, then localhost URL will become example.com.ddev.site.

    ```
    ddev config --project-type=drupal10 --docroot=web --project-name=example.com
    ```
2. Install wunderio/ddev-drupal Composer package with DDEV and restart DDEV:

    ```
    ddev composer require wunderio/ddev-drupal --dev && ddev restart
    ```
3. Ignore this composer plugin managed files from the repo by adding following entries to .gitignore:

```
.ddev/wunderio/core
.ddev/commands/*/wunderio-core-*

```

4. Add changes to GIT (note that below command uses -p, so you need to say 'y'es or 'n'o if it asks what to commit):

    ```
    git add .ddev/ &&
    git add drush/sites/ &&
    git add composer.lock &&
    git add -p composer.json web/sites/default/settings.php grumphp.yml &&
    git commit
    ```

    Also note that whenever you update wunderio/ddev-drupal package, you need to add everything under .ddev to GIT.
5. Import database:

    ```
    ddev import-db --file=some-sql-or-sql.gz.file.sql.gz
    ```

    or install site:

    ```
    ddev drush si
    ```
6. Create admin link and login:

    ```
    ddev drush uli
    ```

Performance Optimization
------------------------

[](#performance-optimization)

### Database Operations for Mac Users

[](#database-operations-for-mac-users)

**Important for Mac users:** When working with database imports and exports on macOS, you should store your database dump files in the `database_dumps` directory at the project root. This directory is specially configured in this template to provide specific performance benefits.

```
project-root/
├── database_dumps/
