## XDebug Configuration for PHPStorm

Follow the steps below to set up XDebug with PHPStorm for both web and console debugging.

### Web Debugging:

1. **Open PHPStorm Settings**: Use the shortcut `Ctrl + Alt + s` and navigate to `PHP` -> `Servers`.
2. Click on the **"+"** button to add a new server.
   - **Name**: Choose a descriptive name, typically the domain you wish to debug (e.g., `beta.stream-up.local`).
   - **Host**: Enter the IP or Domain Name for the Xdebug connection.
   - **Port**: Use `80` for HTTP or `443` for HTTPS. If a custom port like `8080` is set, specify it here.
   - **Debugger**: Select `Xdebug`.
   - Check the **"Use Path Mappings..."** option.
      - Under **Project Files**, specify the root of your project in WSL. Set the "Absolute path on the server" to `/var/www/html`.
      - This mapping ensures that PHPStorm can correctly locate files in your WSL filesystem when debugging.

### Console Debugging:

1. Follow the same steps as for web debugging.
2. In your WSL or Docker Container, execute the command: `export PHP_IDE_CONFIG="serverName=DockerWebServer"`.
3. The primary differences for console debugging are:
   - **Name**: Use the value from `.env` for `PHP_IDE_CONFIG serverName` (e.g., `DockerWebServer`).
   - **Host**: Set to `localhost`.
   - **Port**: Use `80` (the reason remains unclear, but it works).

After setting up, click on the **"Start Listening for PHP Debug Connections"** button in PHPStorm. Then, run your command or access the page that will trigger Xdebug. If no debugging activity is observed, navigate to `PHPStorm Params` -> `PHP` -> `Debug` and enable the **"Break at the first line ..."** option.

Happy debugging!
