Enabling XDebug

On this page you will be guided on activating XDebug PHP debugger in Create Magento App application.

Debugging preparations

The browser

You need to install XDebug Helper by JetBrains extension for Chrome to activate the Debugging session in PHPStorm. Instructions are the same for Firefox.

Install extension

After installation, open extension options and select Debug Trigger value as PHPStorm.

Set Debug Trigger value to PHPSTORM

This extension sets a cookie in your browser's requests: XDEBUG_SESSION=PHPSTORM. This cookie enables debugging in your browser.

Sometimes, you may want to enable debugging outside of the browser (for example, to debug individual GraphQL requests). You can also set XDEBUG_SESSION=PHPSTORM manually in the Cookie header. Most HTTP and GraphQL clients support this option.

Now, when you open your CMA webpage, you need to enable a debug session by pressing Debug in the extensions menu.

The editor

Debugging

First step: Run Create Magento App

Use start command.

yarn start # for Yarn
npm run start  # for NPM

Wait for the command to finish.

Second step: Start the debugger

Choose the create-magento-app debug configuration in the top right corner of PHPStorm's window.

Click on Start debugging or press Shift+F9, put test breakpoint in $project_root/pub/index.php file, reload the page and that is all!

Happy debugging!

Last updated

Was this helpful?