One essential process in development is debugging. One tool which can help this process tremendously is Xdebug which allow us to add breakpoints in codes and see what variables are passing and the contents of the variables when the application running. This allows us to debug the codes if we see mistakes in the variables.
To use Xdebug we need to integrate it with the local server. For Windows, there are binaries which can be installed directly to the PHP extension. For Mac, we need to take a bit more steps.
To install Xdebug make sure that you have installed the CLI make tools (https://developer.apple.com/xcode/). Also, make sure you can run phpize from your XAMPP in the terminal. If you cannot run it then add the following line to .bash_profile file in your home directory ( if you don’t have it just create it yourself).
First, let’s open the PHP information that we used as a local server. You can open it from PHPInfo link in XAMPP dashboard. Select all the page (CMD + A) and copy it. We need to do this to get a personalised installation from Xdebug page.
Then open https://xdebug.org/wizard.php and paste the PHPInfo you copied before in here, then analyse the PHP information.
You will get a personalised installation step such as this.
Just follow the steps explained in the page and Xdebug will be enabled in your server. To check this open PHPInfo from XAMPP dashboard and search for Xdebug.