Click on the "config" button (the cogwheel) and select PHP. If you're using PHP 7.1, you can run:įor CLI Remote Debugging, these are all the configuration settings we need in the ext-xdebug.ini file. Install the Xdebug PHP Extension.įor MacOS users, you can easily install the Xdebug extension for your version of PHP using Homebrew. These steps assume that you are running tests on the same machine that you are editing with. ![]() We will need to configure the Xdebug PHP Extension, Visual Studio Code, and your Terminal for this to work. If you're using Laravel Homestead to develop locally, you may want to read this post to get started. After many hours of stumbling around, I found the configuration that works to use Xdebug Remote Debugging with one of the more popular editors out today, Visual Studio Code. However, I want to use it in the terminal by running PHPUnit tests. You can trigger Remote Debugging in two ways:Īlmost all of the resources I have come across for using Xdebug cover the first use case, via the browser. (You can read about all of the Xdebug features here.) In this post, though, I'm focusing on one specific feature called Remote Debugging (a misleading name since we can debug just fine without a remote system). Xdebug is incredibly powerful and has many underutilized features. Why don't more developers use Xdebug in their development workflow?įrom my experience, many developers don't fully understand the Xdebug architecture and its use cases. I am usually enlightened with the inner workings of Laravel, which is an added benefit. The cost and time savings add up quickly! There have also been occasions where, in the process of stepping through client code, I find myself in Laravel's core code. Using Xdebug, I can step through code while watching values change without having to add a single dd() entry and without the need to run the tests multiple times. However, there are instances where a real debugging setup can improve my efficiency tenfold. ![]() Except now, with a bruised ego.ĭon't get me wrong, dd() is a wonderful tool that I will continue to use. Hours later, I end up closing my open browser tabs and going back to littering my codebase with dd(). ![]() I think to myself, "There has to be a better way." The next thing I know, I'm researching Xdebug blog posts, reading the documentation, and getting frustrated that I still can't get it to work. The process usually begins with me noticing how often I've been using dd() while re-running my PHPUnit tests. I've lost track of how many hours I have spent trying to configure and use Xdebug.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |