Part II First Debug Session
After we installed xdebug in Part I of this post , we now want to test our local debugging.Prerequisits
Installed IIS or apache, php7, xdebugInstall needed chrome xtensions
Chrome developed some useful browserextensions to make things easier for us.Let´s use this nice extensions.
The first extension is "jetbrains-ide-support"
You can install it here https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji
You can install it here https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc
If you click on it, a menue shows you your options
The second plugin connects chrome to xdebug. Thats the green icon left beside the PHPStorm icon.
Let´s add some phpcode to test the debugger.
Add following code to a new phpstorm project:
Now we can start watching the code. Place some breakpoints somewhere in your code an connect the watcher
- Activate the watcher by clicking the "telephone" Icon in the top right
- Set some breakpoints like the following
Now you can open your browser and surfe to your index.php. Your PHPStorm should open up and you should see your debugger working.
You can step-in , step-over your breakpoints and you can directly see what values your variables are, without to use var_dump() and die();
Great Fun!
Keine Kommentare:
Kommentar veröffentlichen