Docker for local PHP development: consistency without the pain
Setting up a repeatable local stack for Laravel/PHP with Docker so the whole team runs the same versions and services.
Getting new developers (or new machines) to match “it works on my machine” is easier when the whole stack is defined in Docker. We use a simple compose setup: PHP-FPM, Nginx, MySQL or PostgreSQL, and Redis, with volumes for code so we can edit locally and run inside the container.
The main trade-off was tuning file sync performance on macOS and Windows so that asset builds and tests stayed fast. Using delegated or cached volume options and running Composer/npm on the host for one-off commands helped.
Documenting the few commands needed to start, seed, and run tests made onboarding and CI alignment straightforward. The same images are now used in CI for consistency from local to pipeline.