PhpStorm Features — Debugging, Testing and Profiling
PhpStorm provides numerous options for debugging your PHP code, so you can:
- Inspect context-relevant local variables and user-defined watches, including arrays and complex objects, and edit values on the fly
- Set up remote debugging for your server
- Evaluate an expression in runtime
- Debug a page in multiple sessions simultaneously
- Keep a debugging session alive while moving between pages
Both Xdebug and Zend Debugger are supported.
You can use our browser bookmarklets, Zend Toolbar or Xdebug toolbar to initiate debugging directly from any page in a modern browser.
Read more about zero-configuration debugging with PhpStorm.
And when (in some cases) you still need to configure debugging manually, read this article: How to configure debugging in PhpStorm
Debugger Configuration Validation
There is nothing more frustrating than not getting PHP Debugging to work because of some configuration error in php.ini.
When configuring the PHP interpreter for project, PhpStorm will inform you if a debugger is installed and will yield Xdebug or Zend Debugger version. From PHP Servers Settings window, you can validate debugger setup: you can test the remote environment on which you want to use the debugger and validate the debugger configuration. PhpStorm will tell you if anything is missing, and how to fix that.
Debugging with Smart Step Into
This debugging feature allows you to choose the function to step into while debugging. This functionality also works with dynamic function calls.
Unit Testing With PHPUnit
Develop PHPUnit tests right in PhpStorm and run them instantly from a directory, file or class using the context menu options. PHPUnit versions higher than 3.3 (including 3.7) are supported. PHPUnit can be run locally or on server (in case of running PHPUnit on server it can be configured with XML configuration file).
Dedicated Run/Debug configurations allow you to run the appropriate set of tests at a later time.
More on using PHPUnit with PhpStorm.
Tests are executed in a dedicated Test Runner UI, displaying results overview and detailed stats for the whole suite and every particular test.
If a test fails, you can instantly jump from the stacktrace to the line of code where the error occurred.
Code Coverage for PHPUnit shows you how much of your code is covered with tests and marks covered and uncovered lines visually right in the editor. Code coverage analysis with PHPUnit is fully supported in the PhpStorm.
You can profile your applications right from the IDE with either Xdebug or Zend Debugger. PhpStorm provides visual representation of profiling data generated by Xdebug or Zend Debugger. You can select several snapshots at a time and collect the aggregated profiling information.
Observe an aggregated report and jump from the execution statistics directly to the function in your PHP code.