Docker also helps you keep your system dependencies under control.The question I get asked most often when discussing my Lando development environment with other Drupal Web Developers is, “How do you setup Lando and PhpStorm to debug Drupal using Xdebug?” This blog post will help you do exactly that.yml file with images to spin up local environment on Linux, Mac OS X and Windows. It is much easier to spin up a docker container rather than starting a new virtual machine (ie Vagrant). Nowadays we move from using the local environment or virtual machines to Docker-based development. Docker + PHP + Xdebug + PHPStorm Good Developer Experience.Now, instead of individual version-specific images such as phpstorm/php-71-apache-xdebug-26, use feature-specific names such as phpstorm/php-cli or phpstorm/php-apache, and provide a version via :tag. You then can tell PhpStorm which docker-compose.yml file to use as the Configuration file(s) and PhpStorm will then provide you with a list of containers to pick from in the Service drop-down.Once you finish, you will be able to use PhpStorm to:The PhpStorm Docker images naming scheme has changed. Even a freshly-installed, blank Drupal website will do.The Server option allows you to pick which Docker server to connect to (Docker for Mac, Docker Machine or direct TCP connection). License Audit is packed into a ready-to-use Docker image.Before you start, you should have a Drupal website up-and-running in Lando. If you're using Docker on Mac or Windows, you can omit this step.Our company develops on both Windows and Mac platforms, and developers often have a Windows PC. These are the steps for configuring Xdebug to live debugging your code: Be sure containers are stopped.
Phpstorm Docker Mac OS XYou should be reasonably familiar with the command line, as well as with the above software.Prepare your Drupal in Lando for PhpStorm: Create a custom php.ini for your Drupal in Lando website:In the root directory of your lando project, create a “config” directory. NOTE: drush 9 is currently NOT supported in PhpStorm because if you had just written your unit test before you wrote that snazzy method, like you were supposed to,…□ Debug phpunit tests for Drupal in Lando Debug drush commands for Drupal in Lando Lando.yml file, so that Lando will include a PHP_IDE_CONFIG for PhpStorm. Conf:Add the following to the “services” key of the. Lando.yml file, so that Lando will include your new php.ini. Lando.yml file for your Drupal in Lando website:Add the following to the “config” key of the. ![]() ![]() For example, /Users/You/Sites/yourdrupal.lndo.site/webAfter the project finishes indexing, the Event log window should be visible. Source Files are in a local directory, no Web server is yet configuredMark as Project Root a directory to create the project in: Lando rebuild -y Create a new PhpStorm Project for your Drupal in Lando website:Open PhpStorm and click on the following: □Rebuild your Drupal in Lando website in order to apply the new settings. Verify that “Set up PHP | Include paths” is checked Drupal installation path: (Select your drupal root directory) Verify that “Enable Drupal integration” is checked. Enable Drupal Support, which should display the “Enable Drupal Integration” configuration window below. Enable the Symfony Plugin with auto configuration now Image Name: devwithlando/php:7.1-apache (or click on the “+” icon at the top left of the pane). Click on the “…” icon to the right of the “CLI Interpreter” field. (or whatever PHP version your Drupal in Lando website uses). PhpStorm > Preferences > Languages & Frameworks > PHP PhpStorm > Preferences > Languages & Frameworks > PHP > FrameworksIf prompted by the Event log window, “Set Drupal-style formatting for this project”.Configure your PhpStorm project: Setup the PHP Interpreter for the project: (or whatever lando provided, if applicable)Set the path mapping for the Drupal in Lando website’s root directory:In the “File/Directory” column, highlight the (path to your Drupal root) row that is listed under the “Project files” folder, by clicking on it. (Change this to match the domain name of your Drupal in Lando website.) Click on the “+” in the top left of the left pane. PhpStorm > Preferences > Languages & Frameworks > PHP > Servers Press the enter key to update the field.Set the path mapping for drush in Lando: If Drupal 8:In the “File/Directory” column, highlight the (path to your included drush) row that is listed the under the “Include path” folder, by clicking on it: Click on the highlighted edit icon that is visible on the right of the same row. Edit the “Absolute path on the server” field for the highlighted row. Downalod steam for mac(to at least verify that the debug session is working)Configure PhpStorm to debug “lando drush” commands for your Drupal in Lando website Enable “Break at first line in PHP scripts” PhpStorm > Preferences > Languages & Frameworks > PHP > Debug You do NOT need an Xdebug Helper browser extension for this to work. Set the path to the Lando appserver’s drush:Test your Drupal in Lando PhpStorm Debugging Setup: Start listening for PHP debug connections:In your web browser, reload your Drupal in Lando website. We don’t select “Drush” here because the path to the Lando appserver’s drush must be entered manually. Select “Custom tool” (not “Drush”) from the dropdown menu. (or click on the “+” icon on the left side of the main pane) If Drupal 7: line 17 (“define”) of index.phpNote: PhpStorm did NOT automatically focus the PhpStorm application in your computer display. If Drupal 8: line 14 (“$autoloader) of index.php
0 Comments
Leave a Reply. |
AuthorMichelle ArchivesCategories |