In the recent weeks, I’ve worked on a few issues, and I found out that I can improve tons of time if I can give my IDEs more lovely tools!
- WordPress assistance
- From IDEs to GitHub links
- Set up xDebug for Lavarel Valet + PHPStorm
I am using two main IDEs: Visual Studio Code (VSCode) and PHPStorm.
- VSCode for quick and remote debugging. In addition, it’s very light.
- PHPStorm for in-depth debugging or coding. Though PHPStorm is very heavy each time it loads, it’s super convenient when I need to work on complicated codebase. It’s like everything is ready to support your productivity.
I tried these guides again to set up WordPress specific assistance for PHPStorm. I could achieve most of things this time (by patiently following up their guide again), especially the hooks support and WP CLI:
As you might know, it’s super nice that PHPStorm can detect and support hooks.
For VSCode, I am using this tool https://marketplace.visualstudio.com/items?itemName=wordpresstoolbox.wordpress-toolbox. It’s not as nice as PHPStorm is, however, it’s good enough to give me some auto suggestions regarding WordPress functions and hooks.
From IDEs to GitHub links
To explain PRs or debugging steps, I have recently grabbed a lot of line references in GitHub. It’s tedious and takes time to search in GitHub repos, find correct files, and choose correct lines.
In searching of a way to quickly open the current line from my IDE in a GitHub repo as recently I could find out this extension for VSCode:
Similarly, I got the same extension for PHPStorm. It works super nice!!!
Set up xDebug for Lavarel Valet + PHPStorm
I spent so much time for trial-and-error steps to debug this issue. It would have been shorter if I could trace the values of each function and step with xDebug. My motivation is to reduce the time to troubleshoot the issue and get faster to the solution.
These are good guides to follow:
- https://www.jetbrains.com/help/phpstorm/2020.2/zero-configuration-debugging.html –
Note for setting up PHPStorm in my case:
- Preferences (Command + ,) > Languages & Frameworks > PHP > Debug: I found out “Validate” option is quite useful.
- Preferences (Command + ,) > Languages & Frameworks > PHP > Debug > DBGProxy:
- IDE key: PHPSTORM
- Host: 127.0.0.1 [it had not worked until I added this value]
- Port: 9001