Docker PHP Tutorial

a Tutorial Series for PHP Developers

Docker PHP Turorial

This page collects all articles that have been published in my tutorial series on developing PHP on Docker. You can find all code samples in the "Docker PHP Tutorial" repository on Github. If you want to follow along when new articles are being published, I'd recommend to

FYI: Some tutorials provide a video with additional information. There is a YouTube playlist available containing all those videos.

Published parts of the Docker PHP Tutorial

Setting up PHP, PHP-FPM and NGINX for local development on Docker

A primer on Docker. What is Docker? How to install it / transition from Vagrant? How to interact with containers? How to organize multiple services (php-cli, php-fpm, nginx) via docker-compose?

👉 Setting up PHP, PHP-FPM and NGINX for local development on Docker (2018-07-08)

Setting up PhpStorm with Xdebug for local development on Docker

Using docker for Development. How to configure PhpStorm to play nicely with Docker? How to setup Xdebug (including the solution for the dreaded 'Connection with Xdebug was not established.' error)?

👉 Setting up PhpStorm with Xdebug for local development on Docker (2018-08-06)

Structuring the Docker setup for PHP Projects

Running a battle-tested development infrastructure for PHP developers in Docker. How to organize the docker folder structure (e.g. shared scripts for containers)? How to establish a convenient workflow via make?

👉 Structuring the Docker setup for PHP Projects (2019-05-20)

Docker from scratch for PHP 8.1 Applications in 2022

An update of the previous article with the learnings of the past 3 years:

  • simplify the setup
  • add more containers (redis, mysql, workers)
  • prepare for additional environments (CI, production)

👉 Docker from scratch for PHP 8.1 Applications in 2022 (2022-03-21)

PhpStorm, Docker and Xdebug 3 on PHP 8.1 in 2022

An update of the previous article on setting up PhpStorm (Part 2) using the latest PHP version (PHP 8.1) as well as the latest Xdebug version (3). The article also covers additional debugging challenges (from the browser, from the CLI, from a long running worker process).

👉 PhpStorm, Docker and Xdebug 3 on PHP 8.1 in 2022 (2022-03-22)

Run Laravel 9 on Docker in 2022

A step-by-step walk through to set up a new Laravel 9 project on the docker setup of this tutorial, using a couple of common Laravel components (Commands, Controllers, Queues, Databases).

👉 Run Laravel 9 on Docker in 2022 (2022-03-23)

Set up PHP QA tools and control them via make

Set up some PHP QA tools like phpcs, phpstan, etc. in the dockerized PHP application and provide make targets to run them either in parallel or individually.

👉 Set up PHP QA tools and control them via make (2022-04-25)

Use git secret to encrypt secrets in the repository

Set up git secret to encrypt and store secrets directly in a git repository. All required tools are set up in Docker and their usage is defined via make targets.

👉 Use git-secret to encrypt secrets in the repository (2022-04-25)

Create a CI pipeline for dockerized PHP Apps

Create a CI pipeline using the dockerized setup introduced in the previous tutorial that can be executed on any CI provider. Concrete examples for Gitlab Pipelines and Github actions are included.

👉 Create a CI pipeline for dockerized PHP Apps (2022-04-25)