Starter kit is based on The perfect kit starter for a Symfony 4 project with Docker and PHP 7.2.
- Apache 2.4.66 (Debian)
- PHP 8.5 FPM
- MySQL 8.3
- NodeJS LTS (latest)
- Composer
- Symfony CLI
- xdebug
- djfarrelly/maildev
- Install Docker and Docker Compose on your machine
- (optional) Add
127.0.0.1 symfony.localin your host file.
-
Run
build-env.sh(orbuild-env.ps1on Windows box) -
Enter the PHP container:
docker-compose exec php bash- To install Symfony LTS inside container execute:
cd app
rm .gitkeep
git config --global --add safe.directory /home/wwwroot/app
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
symfony new ../app --version=lts --webapp
chown -R dev.dev *- Project URL
http://localhost:8000or
http://symfony.local:8000-
MySQL
- inside container: host is
mysql, port:3306 - outside container: host is
localhost, port:3307 - passwords, db name are in
docker-compose.yml
- inside container: host is
-
djfarrelly/maildev i available from the browser on port
8001 -
xdebug i available remotely on port
9000 -
Database connection in Symfony
.envfile:
DATABASE_URL=mysql://symfony:symfony@mysql:3306/symfony?serverVersion=5.7docker compose up -d- start containersdocker compose down- stop containersdocker compose exec php bash- enter into PHP containerdocker compose exec mysql bash- enter into MySQL containerdocker compose exec apache bash- enter into Apache2 container