HOWTO.development_tools - raynaldmo/HOWTO GitHub Wiki
Docker
- Docker | Main Site
- Docker Overview
- Docker Docs
- Docker Reference
- Docker Compose
- Get started with Docker for Mac
- Getting Started with Docker Desktop
- Docker Desktop for Mac
- Docker Hub
- The Ultimate Docker Cheat Sheet
- Restart Docker from command line
$ killall Docker && open /Applications/Docker.app
Docker Courses
DDEV
- DDEV
- DDEV Docs
- DDEV Drupal Multisite
- Sharing your DDEV-Local site via a public URL using "ddev share" and ngrok
Docker Installation
- Docker Installation
- Use Colima - NOTE: When your computer restarts, run
colima start
DDEV Installation
- Homebrew - macOS/Linux
- For macOS (both amd64 and arm64) and Linux users, we recommend installing and upgrading via Homebrew (macOS)
or Homebrew on Linux (Linux)
brew install drud/ddev/ddev
- If you would like more frequent "edge" releases then use brew install drud/ddev-edge/ddev instead.
- As a one-time initialization,
run mkcert -install - Later, to upgrade to a newer version of DDEV-Local, run:
ddev poweroff && brew upgrade drud/ddev/ddev
- Update to a specific version
# If previous version was installed by Homebrew
brew unlink ddev
# Install specific version
curl -fsSL https://ddev.com/install.sh | bash -s v1.24.1
Tips
- Update / Change database
ddev debug migrate-database mariadb:10.4
PhpStorm
- Getting Started
- Documentation | Getting Started
- Learn PhpStorm with PhpStorm Workshop project
- Drupalize.me | PhpStorm
- PhpStorm Plugins
PhpStorm Drupal & DDEV Setup
- Drupal | Configuring PHPStorm
- DDEV | PhpStorm Setup
- DDEV | Step Debugging with Xdebug
- Video | Debugging Code in No Time with DDEV-Local, PhpStorm, and Xdebug
- Running and debugging PHPUnit tests in PHPStorm with DDEV and xdebug
- Debug any of Drupal's PHPUnit tests in PhpStorm with a DDEV-Local Environment
Debugging Notes
- In
settings.local.php, check that Internal Page Cache and Dynamic Page Cache is disabled, otherwise
breakpoints won't be hit
...
$settings['cache']['bins']['page'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
...
- Enable Xdebug for the project
<top-level-project-directory>$ ddev xdebug on
- Turn off Xdebug when not debugging
<top-level-project-directory>$ ddev xdebug status; ddev xdebug off
VSCode Drupal Setup
- For Overview, see Configuring Visual Studio Code
Coding Standards
- Drupalize.me | Drupal Coding Standards
- Code Sniffer and Coding Standards
- See Drupal Coder and Referenced sniff "Slevomat Coding Standard" does not exist
- Install phpcs extension phpcs
- Follow instructions on configuring the extension
- Install coder locally into project
ddev composer require --dev dealerdirect/phpcodesniffer-composer-installer
ddev composer require --dev drupal/coder
- Install phpcs locally into project
ddev composer require --dev squizlabs/php_codesniffer
-
Also see Configure Visual Studio Code for Drupal Development, but instructions appear to be outdated
-
Run phpcs and phpcb from project web container
# ssh into project web container
<top-level-project-directory>$ ddev ssh
# Check installed coding standards
/var/www/html$ phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, Drupal, DrupalPractice, VariableAnalysis and SlevomatCodingStandard
# Check files in web/modules/custom for Drupal coding standards
/var/www/html$ phpcs -p --colors --standard=Drupal,DrupalPractice --extensions=php,module,install web/modules/custom/
# Fix files in web/modules/custom to comply with Drupal coding standards
/var/www/html$ phpcbf -p --colors --standard=Drupal,DrupalPractice --extensions=php,module,install web/modules/custom/
Debugging
- Enable Xdebug for the project
<top-level-project-directory>$ ddev xdebug on
- Turn off Xdebug when not debugging
<top-level-project-directory>$ ddev xdebug status; ddev xdebug off
- From VSCode Click on the Run and Debug Icon (on left panel)
- Click the "Listen for XDebug" dropdown menu and then click on “Add configuration”
- This will open up the
launch.jsonfile which we are going to edit - Remove the existing content in the file and paste in the following code.
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
},
"xdebugSettings": {
"show_hidden": 1
}
}
]
}
- Configure
.ddev/docker-compose.xdebug.yamlas below - Not sure this is needed ?
version: "3.6"
services:
web:
extra_hosts:
- "host.docker.internal:192.168.65.2"
- Set breakpoint at codepoint
- Click "Listen for XDebug" green arrow at top VSCode bar - bottom VSCode bar should turn from blue to orange
- Also See PHP Step Debugging
VSCode WordPress Setup
TBD