Skip to content

Debugging Laravel Sail with XDebug

Configure Laravel application

  1. Update .env file to add these values
1
2
SAIL_XDEBUG_MODE=debug,develop
SAIL_XDEBUG_CONFIG="client_host=host.docker.internal idekey=docker"
  1. Update docker-compose.yml file to add PHP_IDE_CONFIG: 'serverName=Docker' environment variable under laravel.test

  1. To ensure that our docker setup is configured correctly you can temporarily add a new route to your web.php files as the following
1
2
3
Route::get('/phpinfo', function () {
    return phpinfo();
});

Go to http://{your-domain}/phpinfo

You should see similar values as of this:

Great! Everything is set up

References