alyamovsky / symfony-docker-skeleton
A project template for Symfony application running inside of Docker containers for convenient development.
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 2
Open Issues: 0
Language:Makefile
Type:template
pkg:composer/alyamovsky/symfony-docker-skeleton
README
A project template in the following configuration:
- Latest stable Symfony framework (6.4 at the moment), with the ability to specify the version
- PHP 8.3
- PostgreSQL 16.3 (can be altered in the docker compose file) ?
- Separate Docker containers for Nginx, FPM, CLI and a database
- CS-Fixer and Psalm on board
The concept
- The application and docker files are located on the same level: in the /appand/dockerfolders, respectively. This allows you to separate the symphony-application and docker environment variables, and to implement the mono repository pattern by adding new folders if necessary:/centrifugo,s3-storage, etc.
- The compose.override.yamlis ignored by default, so you can add your own settings without worrying about overwriting the original ones.
Quick Start
One-liner to create a new project: composer create-project alyamovsky/symfony-docker-skeleton local_project_path && make setup-configs && make init OPTIONS="webapp" && make up
Split into steps:
- sudo docker run --rm -v $(pwd):/app composer:lts create-project alyamovsky/symfony-docker-skeleton local_project_path(you can also use the- composercommand from the host machine)
- make setup-configs- create .env files for docker containers
- make init OPTIONS="webapp"- very important! Run it before making any commits to your repo. You can omit the- OPTIONSparameter if you don't need to use the webapp.
- make up- start docker containers
Default ports are random (47001-47999) for every created project, so click the link generated in CLI with the output of make up command and enjoy!
You also can set desired ports for Nginx and PostgreSQL manually in generated /.env file (don't forget to run make restart afterwards).
Flags
When running make init, you can use these flags:
- OPTIONS="webapp": Includes web application features. Omit for the basic- symfony/skeletonsetup.
- VERSION=X.Y: Specifies Symfony version. Defaults to the latest stable version, which is 6.4 at the moment.
Examples:
make init OPTIONS="webapp"
make init VERSION=7.2
make init OPTIONS="webapp" VERSION=7.2
Configuring Xdebug settings for PhpStorm IDE
To integrate Xdebug with PhpStorm within a created project you need to do the following:
- Create a PHP interpreter in the Settings -> Languages & Frameworks -> PHPtab from the php-fpm container in the project; make sure that Xdebug works properly in the container.
- Type the port number 9009at the menuSettings -> Languages & Frameworks -> PHP -> Debug -> Xdebug -> Debug.
- Create a server named Dockerin the menuSettings -> Languages & Frameworks -> PHP -> Servers(it matches with the value of theServerNamefield in the IDE config for both interpreters).
- If necessary, make proper mappings in the PHP interpreter Settings -> Languages & Frameworks -> PHP -> Path Mappings,
- Click the button Listen for PHP debug connections; if you have any questions, please read the documentation.