Setup PhpStorm for Laravel with Valet and xDebug (PHP 7.4)

Step 1: install xDebug

Official installation guide:

  1. pecl install xdebug
  2. Validate that xdebug is installed: php -m | grep 'xdebug' . Output should be xdebug.
Warning: mkdir(): File exists in System.php on line 294
PHP Warning: mkdir(): File exists in /usr/local/Cellar/php/7.4.1/share/php/pear/System.php on line 294

Warning: mkdir(): File exists in /usr/local/Cellar/php/7.3.3/share/php/pear/System.php on line 294
ERROR: failed to mkdir /usr/local/Cellar/php/7.4.1/pecl/20180731
  1. pecl config-get ext_dir | pbcopy
  2. mkdir -p {paste clipboard value}
xcode-select --install

Step 2: Add xDebug to Php

  1. First, check the INI files used by php : php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
PHP 7.4.1 (cli) (built: Dec 18 2019 14:46:18) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies
with Xdebug v2.9.7, Copyright (c) 2002-2020, by Derick Rethans

Step 3: Configure PhpStorm

  1. Open Preferences > Languages & Frameworks > PHP
  2. Check that PhpStorm uses the correct CLI Interpreter. Hit the ... on the right side of the CLI Interpreter Dropdown.

Step 4: Install Xdebug Chrome Extension

Install Xdebug Chrome Extension.

Step 5: Start debugging

  1. Just add some breakpoint anywhere in your code:
Set breakpoint to line # 17


If the debug session is not recognized by PhpStorm:

  1. Restart valet
  2. Double check your xdebug installation
  3. Double check the checked checkboxes under Preferences > Languages & Frameworks > PHP Debug
  4. Restart your pc



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
David Joos

David Joos

Works at Bosch.IO as a Software Engineer. Thrilled about coding, beer and other technical stuff ;).