Drupal Development with PHPStorm and Xdebug
Chris Haynes (haynescw)
Have you ever gazed at your screen wondering why your most recent edit is not showing up on the page. So to try to pinpoint what is happening you put 20 print statements in your code hoping that one would show up on you page to let you know where to start your decent into debug land. If this sounds familiar I am here to let you know that there is hope. I was once in the same position.
There have been a few things to help me along my long daunting development process. The first among a long line of improvements in my development world has been the inclusion of PHPStorm and Xdebug.
PhpStorm is a popular IDE growing within the Drupal world, it is utilized by the Acquia development teams and provides native support for Xdebug. Xdebug is a PHP extension that was written and is maintained by Derick Rethans. It provides debugging and profiling capabilities.
With it you can set a breakpoint and pause the execution of a script to see the state of your application at that exact point, including what variables/objects have been instantiated and what their values are.
Xdebug replaces the need to litter your code with echo, print_r() or var_dump() calls, and displays information on all variables. It also allows you to change the values of one or more variables on the fly, affecting the execution of your application.
When the two noted above are combined together you Drupal development and debugging skills will grow to great lengths. This is where I come in. I can help you setup PHPStorm for development of Drupal as well as show you how to setup Acquia Dev Desktop to include Xdebug. Towards the end there will be a section on how you can setup Xdebug when your development environment has been built outside of Acquia Dev Desktop. Some examples may include, using straight DrupalVM, with or without any other helper programs like Bolt. and if there is enough time, how to do it by hand.
One HUGE note, is that you do not want to have Xdebug running on production servers.
For most of the developers attending, your environment may already be setup for you, but if you are anything like me, you may have been pushed into an environment that did not have Xdebug installed.
Learning Objectives & Outcomes:
- How to setup PHPStorm for Drupal Development
- How to setup PHPStorm to use Xdebug
- How to setup prepare Acquia Dev Desktop to include Xdebug
- How to setup DrupalVm to include Xdebug
- How to Manually setup you development environment to include Xdebug
http://2016.tcdrupal.org/session/drupal-development-phpstorm-and-xdebug
Have you ever gazed at your screen wondering why your most recent edit is not showing up on the page. So to try to pinpoint what is happening you put 20 print statements in your code hoping that one would show up on you page to let you know where to start your decent into debug land. If this sounds familiar I am here to let you know that there is hope. I was once in the same position.
There have been a few things to help me along my long daunting development process. The first among a long line of improvements in my development world has been the inclusion of PHPStorm and Xdebug.
PhpStorm is a popular IDE growing within the Drupal world, it is utilized by the Acquia development teams and provides native support for Xdebug. Xdebug is a PHP extension that was written and is maintained by Derick Rethans. It provides debugging and profiling capabilities.
With it you can set a breakpoint and pause the execution of a script to see the state of your application at that exact point, including what variables/objects have been instantiated and what their values are.
Xdebug replaces the need to litter your code with echo, print_r() or var_dump() calls, and displays information on all variables. It also allows you to change the values of one or more variables on the fly, affecting the execution of your application.
When the two noted above are combined together you Drupal development and debugging skills will grow to great lengths. This is where I come in. I can help you setup PHPStorm for development of Drupal as well as show you how to setup Acquia Dev Desktop to include Xdebug. Towards the end there will be a section on how you can setup Xdebug when your development environment has been built outside of Acquia Dev Desktop. Some examples may include, using straight DrupalVM, with or without any other helper programs like Bolt. and if there is enough time, how to do it by hand.
One HUGE note, is that you do not want to have Xdebug running on production servers.
For most of the developers attending, your environment may already be setup for you, but if you are anything like me, you may have been pushed into an environment that did not have Xdebug installed.
Learning Objectives & Outcomes:
- How to setup PHPStorm for Drupal Development
- How to setup PHPStorm to use Xdebug
- How to setup prepare Acquia Dev Desktop to include Xdebug
- How to setup DrupalVm to include Xdebug
- How to Manually setup you development environment to include Xdebug
http://2016.tcdrupal.org/session/drupal-development-phpstorm-and-xdebug