- Ubuntu 20.04 or higher
- docker and docker-compose (optionnal: docker desktop)
- an IDE (phpStorm, Vscode or else)
- Make on your local machine if you want to use the Makefile commands (optionnal)
- git (optionnal but better)
git clonethis project to your project foldergit clone url your-project-directory
- rename the main folder to your project name
mv symfony-stack your-project-name
- copy the .env.template file to .env and set the variables (Ports, project name, etc)
- Set your php version/image in the Dockerfile
FROM php:8.3-apache
docker-compose up --buildORmake buildto build the containers
- once the containers are up and running install Symfony and specify your version :
- with the maker :
make install-symfony version=7.2.x - OR access your php-apache container
docker exec -it php-container-id-or-name bashORmake phpcomposer create-project symfony/skeleton:"7.1.*" .
- with the maker :
- If you are building a microservice or console app or API you're good to go.
- If you need the packages for a webApp :
- with the maker :
make install-symfony-webapp composer require webapp
- with the maker :
- with the maker :
make install-phpunit - OR access your php-apache container
docker exec -it php-container-id-or-name bashORmake phpcomposer require --dev symfony/test-pack
- phpcsfixer
- doctrine
- doctrine fixtures
git init- Remove the origin:
git remote remove origin- Add your repository as origin:
git remote add origin your-repo-ssh-urlgit branch -M mainORgit branch -M mastergit add .git commit -m "Initial commit"git push -u origin mainORgit push -u origin master
make phpunitto run the testsmake fixturesto load the fixturesmake fixto fix with php-cs-fixer
- change the format of the file to LF unix
-
owner in your container should be www-data
-
owner on your local machine should be your user
-
if you need to change ownership :
- access your php container
docker exec -it php-container-id-or-name bashORmake php- go to var
cd /var/www
- change the owner of the www folder
chown -R www-data:www-data html
- access your php container
-
If you can't create a file on your local machine :
- You might need to change the owner of your backend directory on your local machine too
sudo chown -R $USER:$USER backend
- You might need to change the owner of your backend directory on your local machine too
-
check
localhost:8080to see your app running orlocalhost:PHP_APACHE_HOST_PORTyou have set in the .env file -
check
localhost:8088to see your phpmyadmin orlocalhost:PMA_HOST_PORTyou have set in the .env file -
your database is running on port
3308orMYSQL_PORTyou have set in the .env file -
At this point your containers should be running fine. You're ready to go 🚀!
-
If something is wrong check your docker logs