This repository contains a ready-to-use Docker-based LAMP stack for PHP web development. It is designed to be lightweight, clean, and framework-agnostic, making it suitable for Laravel, Symfony, WordPress, or plain PHP projects.
Note: This boilerplate was created to provide a personal, consistent development environment for PHP projects across multiple machines.
Before you begin, make sure you have the following installed on your machine:
- Docker (Engine and CLI)
- Docker Compose (v2 or newer)
- Git (to clone the repository)
- PHP 8.3 with Apache
- MySQL 8 database
- (Optional) phpMyAdmin for database management
- Composer for dependency management
- Optional: Laravel Installer and Symfony CLI
- Central
projects/
directory for all web apps
git clone https://github.com/amiano4/lamp-stack-boilerplate.git
cd lamp-stack-boilerplate
A .env.template
file is included in the repository. Copy it to .env
and edit as needed:
cp .env.template .env
docker-compose up -d
- Main web server: http://localhost:8080
- (Optional) phpMyAdmin: http://localhost:8081 — phpMyAdmin is disabled by default. To enable it, uncomment the
phpmyadmin
service indocker-compose.yml
. (Refer to.env
for the correct credentials)
Begin development inside the projects/
directory. For example:
projects/my-app/index.php
projects/another-app/public/index.php
You may adjust the DocumentRoot
in the Apache virtual host config for framework-specific needs (e.g. Laravel public/
, Symfony public/
).
You can edit the .env
file to customize MySQL root password and database names.
To use CLI tools from within the context of your project directory, first access the container and navigate to your project root:
docker exec -it <PHP_CONTAINER_NAME> bash && cd /var/www/html/projects
Then you can run PHP, Composer, Laravel, or Symfony commands as needed.
You can work on framework-based or agnostic projects directly from the container using CLI tools. For example:
# Run PHP commands
php -v
# Use Composer to install dependencies
composer install
# Create a new Laravel project (if Laravel Installer is enabled)
laravel new my-laravel-app
# Run Symfony CLI commands (if installed)
symfony check:requirements
# To exit the CLI
exit
To enable Laravel or Symfony CLI tools, uncomment the corresponding lines in the Dockerfile
.
Database and other persistent files are stored in the volumes/
directory (ignored by Git). A .gitkeep
file is included to retain the folder structure.
MIT — free to use, modify, and distribute.