tavib47 / drupal-boilerplate
Project template for Drupal 11 projects
Requires
- composer/installers: ^2.3
- cweagans/composer-patches: ^1.7
- drupal/admin_toolbar: ^3.5
- drupal/ajax_loader: ^2.1
- drupal/anchor_link: ^3.0
- drupal/autologout: ^2.0
- drupal/better_exposed_filters: ^7.0
- drupal/captcha: ^2.0
- drupal/chosen: ^5
- drupal/ckeditor_accordion: ^2.3
- drupal/ckeditor_iframe: ^3.1
- drupal/cookies: ^1.2
- drupal/core-composer-scaffold: ^11
- drupal/core-project-message: ^11
- drupal/core-recipe-unpack: ^11
- drupal/core-recommended: ^11
- drupal/easy_breadcrumb: ^2.0
- drupal/easy_email: ^3.0
- drupal/editor_advanced_link: ^2.3
- drupal/environment_indicator: ^4.0
- drupal/facets: ^2.0
- drupal/field_group: ^3.6
- drupal/genpass: ^2.1
- drupal/gin: ^5.0
- drupal/gin_toolbar: ^3.0
- drupal/google_tag: ^2.0
- drupal/honeypot: ^2.2
- drupal/layout_builder_at: ^3.0
- drupal/layout_builder_operation_link: ^2.2
- drupal/mail_login: ^4.0
- drupal/metatag: ^2.1
- drupal/monolog: ^3.0
- drupal/pathauto: ^1.13
- drupal/rabbit_hole: ^1.0
- drupal/redirect: ^1.10
- drupal/redis: ^1.10
- drupal/remove_username: ^1.5
- drupal/restui: ^1.22
- drupal/search_api: ^1.35
- drupal/svg_image_field: ^2.3
- drupal/symfony_mailer_lite: ^2.0
- drupal/toolbar_language_switcher: ^2.0
- drupal/webform: ^6.3@beta
- drush/drush: ^13.3
- eaudeweb/heavy-lifter: ^2
- noli42/chosen: ^3.0
- tavib47/drupal-pixel-standard: dev-main
Requires (Dev)
- brainmaestro/composer-git-hooks: ^3.0
- drupal/coder: ^8.3
- drupal/core-dev: ^11
- drupal/drupal-extension: ^5.1
- drupal/stage_file_proxy: ^3.1
- drupal/upgrade_status: ^4.3
- mglaman/phpstan-drupal: ^1.3
- overtrue/phplint: ^9.5
- palantirnet/drupal-rector: ^0.20.3
- phpmd/phpmd: ^2.15
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12
- phpstan/phpstan-deprecation-rules: ^1.2
Conflicts
README
A comprehensive project template for Drupal 11 development with pre-configured modules and development tools.
Quick Start
1. Create new project from template
composer create-project tavib47/drupal-boilerplate:^11 my-project-name --ignore-platform-reqs --no-interaction
cd my-project-name
2. Edit project details
Edit the project name, description and other details in the following files:
- composer.json
- example.robo.yml
- .ddev/config.yaml
- drush/example.drush.yml
- sites/default/settings.ddev.local.php
- README.md (also delete the Drupal 11 Boilerplate title and Quick Start section)
3. Configure DDEV
ddev config --project-name=my-project-name --project-type=drupal11 --docroot=web
4. Install Drupal
ddev start
ddev drush site:install pixel_standard --site-name="My Project Name" --account-name=office@example.com --account-mail=office@example.com --site-mail=office@example.com --account-pass=password
5. Export configuration
ddev drush cex -y
6. Initialize git repository
git init git add . git commit -m "Initial commit"
My Project Name
I. Prerequisites
- mkcert (run
mkcert -install
) - DDEV 1.22.0+ (https://ddev.com/get-started)
If you get the Could not connect to a docker provider. Please start or install a docker provider.
error you need to add your user to docker
group:
sudo usermod -aG docker $USER
newgrp docker
II. Project setup
- Clone the repository
- Copy
example.robo.yml
torobo.yml
and customizeusername
,password
andadmin_username
- Copy
.env.example
to.env
- Copy
drush/example.drush.yml
todrush/drush.yml
III. Installation
1. First time installation
ddev drush site-install --existing-config --site-name="My Project Name" --account-name=office@example.com --account-mail=office@example.com --site-mail=office@example.com --account-pass=password
2. Retrieving the database and files from production or staging
./scripts/install.sh
IV. Development
- Run
ddev start
to start the project without reinstalling the database - Run
ddev stop
to stop the project - Run
ddev launch
to launch the application in the browser or access https://my-project-name.ddev.site:14443 - Running drush commands:
ddev drush command
(e.g.ddev drush config:export
) - Running custom apps within vendor:
ddev exec ./vendor/bin/app command
(e.g.ddev exec ./vendor/bin/robo site:update
)
Other scripts
./scripts/update.sh
: Reinstalls all modules, libraries and updates the Drupal instance../scripts/code-qa.sh
: Runs PHPCS and PHPCBF on custom modules and themes../scripts/start.sh
: Starts the DDEV containers and launches the application in the browser.
Theme development
Node Version Manager and Node are already installed in the DDEV's web container.
Start a shell session in the web container (ddev ssh
) and run the following commands:
- Go to theme directory:
cd web/themes/custom/theme_name
- Install node version:
nvm install
- Change node version:
nvm use
- Run the watcher or the build command:
npm run watch
npm run build
Composer
DDEV provides a built-in command to simplify use of PHP’s dependency manager, Composer, without requiring it to be installed on the host machine.
ddev composer help
runs Composer’s help command to learn more about what’s available.
Email Capture and Review (MailHog)
After your project is started, access the MailHog web interface at http://my-project-name.ddev.site:18025, or run ddev launch -m
to launch it in your default browser.
Using Development Tools on the Host Machine
Tools that interact with files and require no database connection, such as Git or Composer, can be run from the host machine against the codebase for a DDEV project with no additional configuration necessary.
Xdebug
- Configure PHPStorm debug: https://ddev.readthedocs.io/en/stable/users/debugging-profiling/step-debugging/#phpstorm-rundebug-configuration-debugging
- Run
ddev xdebug on
to enable Xdebug - Run
ddev xdebug off
to disable Xdebug
If you want to use Xdebug with a Drush command:
- Create a server in PHPStorm (Project settings->Servers) and name it
my-project-name.ddev.site
- In the PHPStorm server configuration, map your host project directory to /var/www/html
- Run the drush command inside the container (
ddev ssh
):./vendor/bin/drush command