Skeleton
Description
A skeleton of application, which can be used if you have to satrt a new project with Symfony, Ningx, PHP and Mysql.
Purpose
This skeleton will be used on new and actual projects in our organization In our skeleton we want a stack which is capable to run a Symfony application
What is in Skeleton ?
Docker
- Nginx: 1.19
- PHP: 7.4
- Mysql: 8.0
- QualityAssurance: 7.4
- Redis: 6.0
- Mailcatcher
- PhpMyAdmin
Symfony
Version 5.1
Functionnal Test
We use Behat. To run behat use:
make behat
Unit Test
We use PHPUnit. To run unit test use:
make unit-test
Makefile
To see all usefull command run:
make help
How to start with Skeleton ?
First replace "skeleton" occurence with your project name
- Change all occurences of "skeleton" in Makefile
- Change host "skeleton.docker" in site.conf
- Change "skeleton" in .bashrc
- Change base url "https://skeleton.docker" in behat.yml.dist
- Change database name "skeleton" in .env
- Change dump name "skeleton.sql" in FixtureContext
- Change local domain "https://skeleton.docker" in ErrorHandlerContext.php
- Change urls which finish with "skeleton.docker" in docker-compose.override.yaml.dist
Add host in your /etc/hosts
sudo vim /etc/hosts
127.0.0.1 your-host.fr 127.0.0.1 pma.your-host.fr 127.0.0.1 mailcatcher.your-host.fr
Install the project
make install
Work with project
If you have already install the project and you want to switch to another project or stop for today, just stop your project:
make stop
And start when you need with:
make start
Database management
We used a dump to reload faster our database. To load your database use:
make db-load-fixtures
Update dump
If you add some migration or some fixtures, you have to update your dump with:
make db-reload-fixtures
PhpMyAdmin
To access PhpMyAdmin use: https://pma.your-host.fr
- Login: root
- Password: root
Quality of our code
We have some quality tools and to run all this tools, you can use:
make code-quality
In our quality tools you can find:
Security checker of symfony
This tools check, if you have vulnerability in your dependencies
make security-checker
PHPmd
make phpmd
Composer unused
This tools allows you to check if you have unused dependencies
make composer-unused
Yaml Linter
make yaml-linter
Xliff Linter
make xliff-linter
Twig Linter
make twig-linter
Container Linter
make container-linter
PHPStan
make phpstan
CS Fixer
This tools check if you have error in your coding styles.
To show this error use:
make cs
To fix this errors use:
make cs-fix
Validate database schema
This Symfony command check if your database schema is coherent with your entities annotation
make db-validate
Mailcatcher
If your local app send mail, your mail will be catched by the mailcatcher. To see this mail go to: https://mailcatcher.your-host.fr
Next step
If you want to help use, you can add some features like:
- A gitlab-ci.yaml example
- Add a docker image for S3 storage and some test
- Upgrade symfony version to 5.2
- Add Mac support
This are idea, but feel free to suggest any features you want!!