Skip to content

Commit 9bdb0f5

Browse files
authored
Merge pull request #4 from juananrey/develop
Adding some minimal structure + PHPUnit + PHPCS
2 parents a5647fe + 7b3b071 commit 9bdb0f5

File tree

28 files changed

+1172
-6
lines changed

28 files changed

+1172
-6
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77

88
###> PHPStorm ####
99
.idea
10-
###< PHPStorm ####
10+
###< PHPStorm ####
11+
12+
###> symfony/phpunit-bridge ###
13+
.phpunit
14+
/phpunit.xml
15+
###< symfony/phpunit-bridge ###

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Basic Symfony Flex Project With Docker + PHPUnit + PHPCS
2+
--------------------------------------------------------
3+
4+
Basic skeleton containing just a `/_healthcheck` endpoint, and including:
5+
- Dockerized startup (with PHP-FPM + nginx, check `/docker` folder and the `README.md` in there).
6+
- PHPUnit (run `bin/phpunit` to pass the unit and functional tests).
7+
- PHPCS (symlink to `/vendor/bin/phpcs`, run `bin/phpcs` to run a code sniffer based on PSR2 standard).
8+
9+
## Requirements
10+
- Docker
11+
12+
## Installation
13+
1) On the root folder, run: `docker-compose up -d` and wait for all required packages to install.
14+
2) Get into the machine (`docker exec -ti mylocalproject-php-fpm bash`) and run a `composer install` from inside
15+
3) Go to [localhost:8000/_healthcheck](http://localhost:8000/_healthcheck), where you should be able to see this output:
16+
```json
17+
{
18+
"status": "i am ok"
19+
}
20+
```
21+
22+
Now, it is completely up to you how do you want your project to grow :)

bin/phpcs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../vendor/bin/phpcs

bin/phpunit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
5+
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
6+
exit(1);
7+
}
8+
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
9+
putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');
10+
}
11+
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
12+
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
13+
}
14+
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
15+
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
16+
}
17+
18+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
"require": {
55
"php": "^7.1.3",
66
"ext-iconv": "*",
7+
"sensio/framework-extra-bundle": "^5.1",
78
"symfony/console": "^4.0",
89
"symfony/flex": "^1.0",
910
"symfony/framework-bundle": "^4.0",
1011
"symfony/lts": "^4@dev",
1112
"symfony/yaml": "^4.0"
1213
},
1314
"require-dev": {
14-
"symfony/dotenv": "^4.0"
15+
"symfony/browser-kit": "^4.0",
16+
"symfony/css-selector": "^4.0",
17+
"symfony/dotenv": "^4.0",
18+
"symfony/phpunit-bridge": "^4.0",
19+
"squizlabs/php_codesniffer": "3.*"
1520
},
1621
"config": {
1722
"preferred-install": {

0 commit comments

Comments
 (0)