mrjoops / symfony-service-devtools
A set of useful tools for building Symfony services.
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Makefile
Requires
- friendsofphp/php-cs-fixer: ^2.15
- mavimo/phpstan-junit: ^0.2.3
- phpmd/phpmd: ^2.7
- phpstan/extension-installer: ^1.0
- phpstan/phpstan-symfony: ^0.11.6
- squizlabs/php_codesniffer: ^3.4
- symfony/test-pack: ^1.0
README
A set of useful tools for building Symfony services. To date, it includes:
- Code quality tools with gently defaults
- Testing tools
- A ready to go Docker environment
- Configuration for CI tool Bitbucket Pipelines
- a Makefile to ease interaction with these tools
Installation
You can install it with Composer.
composer config extra.symfony.allow-contrib true
composer require --dev mrjoops/symfony-service-devtools
Prerequisites
Although both are optional, please ensure you have installed docker-compose alongside Docker on your system.
If you use Symfony Flex, you can safely jump to the Usage section. Otherwise you must copy the following files in your project to enjoy all the features:
- .env.test
- .php_cs.dist
- bitbucket-pipelines.yml
- docker-compose.yml
- Dockerfile
- dredd.yml
- Makefile
- phpcs.xml.dist
- phpmd.xml
- phpstan.neon.dist
- phpunit.xml.dist
cp vendor/mrjoops/symfony-service-devtools/{.env.test,.php_cs.dist,bitbucket-pipelines.yml,docker-compose.yml,Dockerfile,dredd.yml,Makefile,phpcs.xml.dist,phpmd.xml,phpstan.neon.dist,phpunit.xml.dist} .
Don't forget to add the following lines in your .gitignore
file:
/.php_cs
/.php_cs.cache
/phpcs.xml
/.phpcs-cache
/phpstan.neon
/phpunit.xml
.phpunit.result.cache
/test-reports/
/vendor/
Feel free to edit these files to fit your needs.
Usage
Quality tools
You can run all the code quality tools with this command:
make check
You can run them individually:
make md
make sniff
make stan
make style
You can also run the fixers with this command:
make fix
And again, you can run them individualy:
make fix-sniff
make fix-style
Testing tools
You can run all the testing tools with this command:
make test
You can run them individually:
make dredd
make unit
A note about Dredd
Since Dredd is a NodeJS tool, it is not installed with mrjoops/symfony-service-devtools
. However it is included in the Docker image (see below) and ready to go!
Docker
You can add services to the docker-compose.yml
file.
Then you can start your services with the following command:
docker-compose up -d
The base Docker image used here is mrjoops/ppm which uses PHP-PM, so you have an efficient PHP web server up and running!
Continuous integration
A configuration for Bitbucket Pipelines exists, it will run all checks and tests on pull requests.
Opinionated advices
- Do yourself a favor and create this alias:
alias dk='docker-compose exec app'
so you'll just have to prefix your commands withdk
to have them executed in the container. - It's a good idea to add
make check
(ordk make check
) to your git workflow by creating a pre-commit hook.