Member-only story
Setup Xdebug in Laravel 8 like a boss
I’m finally here after many frustrating hours of back and forth, trying different things in order to get Xdebug to play nicely with the latest instalment (8 as of this writing) of everyone’s favourite PHP framework, Laravel, setup with Sail. And so, without further ado, here we go.
For this tutorial make sure you have Docker Desktop installed. We’re also using PHPStorm as our IDE of choice.
Laravel installation
Run the following command in your project folder to get the latest copy of Laravel 8.
curl -s "https://laravel.build/xdebug-app" | bash
Navigate into your new application
cd xdebug-app
and run
./vendor/bin/sail up -d
You can now head over to your browser and go to
http://localhost
and you’ll see your newly installed Laravel application.
Alright! That’s the easy part out of the way. Let’s get our hands dirty.
Xdebug Configuration
Laravel doesn’t come with Xdebug out-of-the-box and since we’re using Docker, we need to make a few changes to our Dockerfile.