Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrjoops/symfony-service-devtools
https://github.com/mrjoops/symfony-service-devtools
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mrjoops/symfony-service-devtools
- Owner: mrjoops
- License: mit
- Created: 2019-08-26T09:59:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-27T11:55:21.000Z (over 5 years ago)
- Last Synced: 2024-04-01T00:02:30.034Z (9 months ago)
- Language: Makefile
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mrjoops/symfony-service-devtools
A set of useful tools for building [Symfony](https://symfony.com) services.
To date, it includes:* Code quality tools with gently defaults
* [PHPMD](https://phpmd.org/)
* [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
* [PHP CS Fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer)
* [PHPStan](https://github.com/phpstan/phpstan)
* Testing tools
* [Dredd](https://dredd.org)
* [PHPUnit](https://phpunit.de/)
* 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](https://getcomposer.org).
```
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](https://hub.docker.com/search?q=&type=edition&offering=community) on your system.
If you use Symfony Flex, you can safely jump to the [Usage](#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.
### 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](https://cloud.docker.com/u/mrjoops/repository/docker/mrjoops/ppm) which uses [PHP-PM](https://github.com/php-pm/php-pm), so you have an efficient PHP web server up and running!
## Continuous integration
A configuration for [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) exists, it will run all checks and tests on pull requests.
## Opinionated advices
1. Do yourself a favor and create this alias:
`alias dk='docker-compose exec app'`
so you'll just have to prefix your commands with `dk` to have them executed in the container.
2. It's a good idea to add `make check` (or `dk make check`) to your git workflow by creating a pre-commit hook.