A comprehensive PHP development environment using Docker Compose with support for multiple PHP versions, intelligent routing, and custom CLI tools.
- Multi-PHP Support: PHP 7.4 and 8.4 with intelligent version detection
- Custom Domains:
.localTLD support (app1.local, rms.local, etc.) - Intelligent CLI:
iumcommand for context-aware PHP execution - Complete Stack: Apache, MariaDB, Redis, Mailpit, phpMyAdmin
- Easy Configuration: Host-mounted config volumes for easy customization
- Data Persistence: Separate data volumes for databases and caches
-
Setup Environment:
chmod +x setup.sh ./setup.sh
-
Access Applications:
- http://app1.local (PHP 7.4)
- http://rms.local (PHP 7.4)
- http://app3.local (PHP 8.4)
- http://app4.local (PHP 8.4)
-
Development Services:
- phpMyAdmin: http://localhost:8080
- Mailpit: http://localhost:8025
- MariaDB: localhost:3306 (root/root)
- Redis: localhost:6379
ium/
├── docker-compose.yml # Main Docker Compose configuration
├── Dockerfile.php-apache # Custom PHP/Apache image
├── setup.sh # Automated setup script
├── ium # CLI tool
├── www/ # Web applications
│ ├── find-app.php # App discovery utility
│ ├── php74/ # PHP 7.4 applications
│ │ ├── app1/
│ │ └── rms/
│ └── php84/ # PHP 8.4 applications
│ ├── app3/
│ └── app4/
├── config/ # Configuration files
│ ├── apache/ # Apache virtual hosts
│ ├── php74/ # PHP 7.4 configuration
│ ├── php84/ # PHP 8.4 configuration
│ ├── mysql/ # MariaDB configuration
│ ├── redis/ # Redis configuration
│ ├── phpmyadmin/ # phpMyAdmin configuration
│ └── supervisor/ # Process supervisor
├── data/ # Persistent data
│ ├── mysql/ # MariaDB data
│ └── redis/ # Redis data
└── logs/ # Log files
└── apache/ # Apache logs
The ium command provides intelligent command execution based on your current directory:
# Show PHP version (auto-detected from directory)
ium php -v
# Run Laravel Artisan commands
cd www/php74/app1
ium php artisan about
# Install Composer dependencies
ium composer install
# Install NPM dependencies
ium npm install
# Run any shell command
ium ls -la
ium git status
ium bash
# Run any PHP script
ium php script.php# Container management
ium wake # Start all containers
ium sleep # Stop all containers
ium reborn # Rebuild containers from scratch
# Update hosts file with .local domains
ium reload
# Show environment status
ium status
# Show help
ium help- Version Detection: Automatically detects PHP version from directory path
- Container Execution: Routes commands to appropriate PHP environment in container
- Working Directory: Maintains correct working directory context
- Command Intelligence: Automatically handles PHP and Composer commands with correct versions
- Domain Management: Automatically manages
.localdomain entries in hosts file
- PHP 7.4: Located in
/www/php74/ - PHP 8.4: Located in
/www/php84/
Both versions include common extensions:
- MySQL/MariaDB support
- Redis support
- GD, cURL, mbstring, XML, JSON
- Composer pre-installed
Apache intelligently routes requests based on:
- Directory structure (
/php74/→ PHP 7.4,/php84/→ PHP 8.4) - Custom
.localdomains (automatic app discovery) - Fallback app finder for flexible routing
- MariaDB: Latest version with UTF8MB4 support
- Default Database:
ium_default - Credentials: root/root, ium_user/ium_password
- Port: 3306
- Redis: Alpine version with custom configuration
- Port: 6379
- Persistence: Enabled with both RDB and AOF
- Mailpit: Modern email testing tool
- SMTP: Port 1025
- Web Interface: http://localhost:8025
-
Create Directory:
mkdir -p www/php84/mynewapp
-
Add Application Files:
echo "<?php phpinfo(); ?>" > www/php84/mynewapp/index.php
-
Update Hosts:
ium reload
-
Access Application:
All configuration files are mounted from the config/ directory:
- Apache:
config/apache/ - PHP Settings:
config/php74/andconfig/php84/ - Database:
config/mysql/ - Redis:
config/redis/
Edit these files and restart services:
docker compose restartNavigate to the appropriate directory and use ium:
# PHP 7.4 environment
cd www/php74/app1
ium php -v # Shows PHP 7.4.x
ium composer install # Uses PHP 7.4
# PHP 8.4 environment
cd www/php84/app3
ium php -v # Shows PHP 8.4.x
ium php artisan migrate # Uses PHP 8.4# Start all services
docker compose up -d
# Stop all services
docker compose down
# Restart services
docker compose restart
# View logs
docker compose logs -f
# Rebuild containers
docker compose build --no-cache# Restart specific service
docker compose restart php-apache
# View service logs
docker compose logs -f mariadb
# Execute commands in container
docker compose exec php-apache bash-
Port Conflicts:
- Check if ports 80, 3306, 6379, 8080, 8025 are available
- Stop conflicting services or modify ports in docker-compose.yml
-
Permission Issues:
- Ensure proper ownership of www/ directory
- Run:
sudo chown -R $USER:$USER www/
-
Domain Not Working:
- Run
ium reloadto update hosts file - Clear browser cache and restart browser
- Run
-
Container Won't Start:
- Check logs:
docker-compose logs - Rebuild:
docker-compose build --no-cache
- Check logs:
- Apache:
logs/apache/ - PHP-FPM: Inside container at
/var/log/ - Docker:
docker-compose logs
- This environment is designed for development only
- Default passwords are used (change for production)
- Services are exposed on localhost only
- SSL is not configured by default
- Fork the repository
- Create feature branch
- Test thoroughly
- Submit pull request
This project is open source. Feel free to modify and distribute.
For additional help, run ium help or check the Docker Compose logs.