Skip to content

A boilerplate setup to run a Laravel application using Docker, with Xdebug enabled for local PHP debugging.

Notifications You must be signed in to change notification settings

devdiogenes/laravel-docker-xdebug

Repository files navigation

Laravel Docker + Xdebug

A boilerplate setup to run a Laravel application using Docker, with Xdebug enabled for local PHP debugging.

📦 Features

  • Laravel application running inside Docker containers
  • Preconfigured PHP container with Xdebug support
  • MySQL / MariaDB database container
  • Apache as web server
  • Easy host & network configuration

🧰 Prerequisites

Before you get started, you’ll need:

  • Docker (Engine) installed
  • Docker Compose installed
  • Git
  • VSCode + Dev Containers extension (you can try another editor / IDE, but this is the one I used for develop and test it)
  • It was tested only in Linux, but I believe it will works fine in Windows too

🏗️ Setup & Installation

If you with, you can start a Laravel application in the way you think is better and just copy containers files to your repository, but if you want to use the Laravel application in this repository, here is the step-by-step:

  1. Clone the repository

    git clone https://github.com/devdiogenes/laravel-docker-xdebug.git
    cd laravel-docker-xdebug
  2. Copy .env.example to .env and adjust configuration if needed

    cp .env.example .env
    ```.
    
  3. Open the folder in VSCode

    code .
  4. Press Ctrl + Shift + P and open it as a dev container

image
  1. Get your MariaDB container name

    docker ps
  2. Set your MariaDB container name as DB_HOST in .env

image
  1. Open terminal in VSCode (inside remote container)

  2. Install PHP dependencies

    composer install
  3. Generate Laravel application key

    docker-compose exec app php artisan key:generate
  4. Run migrations

    php artisan migrate
  5. Access your application in the browser
    The default URL is typically http://127.0.0.1

🤝 Contributing

Contributions, issues, and feature requests are welcome.

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m "Add some feature")
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

📜 License

This project is open-sourced software licensed under the MIT License.

About

A boilerplate setup to run a Laravel application using Docker, with Xdebug enabled for local PHP debugging.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages