Skip to content

Commit c06a005

Browse files
committed
Hexagonal example
1 parent 2d6f05c commit c06a005

File tree

210 files changed

+20426
-1306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+20426
-1306
lines changed

.editorconfig

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[*.{php,html,twig,xml}]
2+
indent_style = space
3+
indent_size = 4
4+
5+
[*.{yml,yaml,graphql}]
6+
indent_style = space
7+
indent_size = 2
8+
9+
[config/packages/**/*.{yml,yaml}]
10+
indent_size = 4
11+
12+
[*.js]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[webpack.config.js]
17+
indent_size = 4
18+
19+
[*.json]
20+
indent_style = space
21+
indent_size = 4
22+
23+
[tests/**/expected/**/*.json]
24+
indent_size = 2
25+
26+
[*.{css,scss}]
27+
indent_style = space
28+
indent_size = 2

.env

+51-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,55 @@
1616

1717
###> symfony/framework-bundle ###
1818
APP_ENV=dev
19-
APP_SECRET=b250235038ffa595d89aebb2c25b374c
19+
20+
# Runtime env / deploy target (local|staging|production)
21+
APP_RUNTIME_ENV=local
22+
APP_SECRET=99938de29c31d752c9e73751ef62866d
23+
TRUSTED_PROXIES=127.0.0.1
24+
TRUSTED_HOSTS='(localhost|127.0.0.1)$'
25+
26+
# Override in your .env.local or .env.dev.local file:
27+
APP_FRONT_HOST=127.0.0.1:63281
28+
APP_FRONT_SCHEME=http
29+
2030
###< symfony/framework-bundle ###
31+
32+
33+
34+
###> doctrine/doctrine-bundle ###
35+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
36+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
37+
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=15&charset=utf8"
38+
###< doctrine/doctrine-bundle ###
39+
40+
###> symfony/messenger ###
41+
MESSENGER_TRANSPORT_DSN=doctrine://default
42+
###< symfony/messenger ###
43+
44+
###> symfony/router ###
45+
ROUTER_DEFAULT_URI=http://127.0.0.1:63280
46+
###< symfony/router ###
47+
48+
###> graphiql ###
49+
GRAPHIQL_JWT_TOKEN=
50+
###< graphiql ###
51+
52+
###> symfony/mailer ###
53+
# Send mails to Mailhog:
54+
MAILER_DSN=smtp://localhost
55+
# or, to disable:
56+
#MAILER_DSN=null://null
57+
# Defautl from for emails:
58+
MAILER_DEFAULT_FROM_NAME="EXAMPLE"
59+
MAILER_DEFAULT_FROM_EMAIL=[email protected]
60+
###< symfony/mailer ###
61+
62+
###> lexik/jwt-authentication-bundle ###
63+
JWT_SECRET_KEY=%kernel.project_dir%/var/jwt/private.pem
64+
JWT_PUBLIC_KEY=%kernel.project_dir%/var/jwt/public.pem
65+
JWT_PASSPHRASE=d77d04852309b564f6355b9d4e86352e0e3f86d78f2d880fb8a69cf55f8e41d1
66+
###< lexik/jwt-authentication-bundle ###
67+
68+
###> nelmio/cors-bundle ###
69+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
70+
###< nelmio/cors-bundle ###

.env.test

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
APP_DEBUG=0
5+
APP_FRONT_HOST=test.front.example.com
6+
7+
###> symfony/router ###
8+
ROUTER_DEFAULT_URI=http://test.api.example.com
9+
###< symfony/router ###
10+
11+
###> symfony/mailer ###
12+
MAILER_DSN=null://null
13+
MAILER_DEFAULT_FROM_NAME="EXAMPLE"
14+
MAILER_DEFAULT_FROM_EMAIL=[email protected]
15+
###< symfony/mailer ###
16+
17+
# Use whenever you need to regenerate the baseline (do not blindly commit the changes):
18+
#UPDATE_DEPRECATIONS_BASELINE=true
19+
SYMFONY_DEPRECATIONS_HELPER="max[direct]=0&max[self]=0&max[total]=999999&quiet[]=indirect&verbose=1&baselineFile=./tests/allowed-deprecations.json&generateBaseline=$UPDATE_DEPRECATIONS_BASELINE"

.gitignore

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@
33
/.env.local
44
/.env.local.php
55
/.env.*.local
6-
/config/secrets/prod/prod.decrypt.private.php
6+
/config/secrets/**/*.decrypt.private.php
7+
!/config/secrets/**/local.decrypt.private.php
78
/public/bundles/
89
/var/
910
/vendor/
1011
###< symfony/framework-bundle ###
12+
13+
###> tools ###
14+
/tools/**/vendor/
15+
###< symfony/framework-bundle ###
16+
17+
###> phpunit/phpunit ###
18+
/phpunit.xml
19+
.phpunit.result.cache
20+
###< phpunit/phpunit ###
21+
22+
###> friendsofphp/php-cs-fixer ###
23+
/.php-cs-fixer.php
24+
/.php-cs-fixer.cache
25+
###< friendsofphp/php-cs-fixer ###

.php-cs-fixer.dist.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude([
6+
'var',
7+
'node_modules',
8+
'config/secrets',
9+
])
10+
->notPath([
11+
'config/bundles.php',
12+
'deploy.php',
13+
])
14+
;
15+
16+
return (new PhpCsFixer\Config())
17+
->setRiskyAllowed(true)
18+
->setFinder($finder)
19+
->setRules([
20+
'@Symfony' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'concat_space' => ['spacing' => 'one'],
23+
'phpdoc_to_comment' => ['ignored_tags' => [
24+
// https://github.com/phpstan/phpstan/issues/5465
25+
'use',
26+
]],
27+
'declare_strict_types' => true,
28+
'native_function_invocation' => ['include' => ['@compiler_optimized']],
29+
'no_superfluous_phpdoc_tags' => true,
30+
'ordered_imports' => true,
31+
'operator_linebreak' => [
32+
'only_booleans' => true,
33+
'position' => 'end',
34+
],
35+
'phpdoc_summary' => false,
36+
'phpdoc_annotation_without_dot' => false,
37+
'phpdoc_order' => true,
38+
'single_line_throw' => false,
39+
'simplified_null_return' => false,
40+
'yoda_style' => [],
41+
])
42+
;

Makefile

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# --------------------------------#
2+
# "make" command
3+
# --------------------------------#
4+
5+
-include ./make/text.mk
6+
-include ./make/help.mk
7+
-include ./make/url.mk
8+
9+
###########
10+
# Install #
11+
###########
12+
13+
## Install dependencies
14+
install: install.composer install.jwt
15+
16+
install.composer:
17+
symfony composer install
18+
symfony composer --working-dir=tools/php-cs-fixer install
19+
20+
install.jwt:
21+
php bin/console lexik:jwt:generate-keypair --skip-if-exists
22+
23+
## Update dependencies
24+
update: update.composer
25+
26+
## Update Symfony dependencies only
27+
update.symfony:
28+
symfony composer update "symfony/*"
29+
30+
update.composer:
31+
symfony composer update
32+
33+
############
34+
# Database #
35+
############
36+
37+
## Database - Init (create+schema)
38+
db.install: db.create db.update-force
39+
40+
## Database - Create (db only)
41+
db.create:
42+
symfony console doctrine:database:create --if-not-exists
43+
44+
## Database - Drop
45+
db.drop:
46+
symfony console doctrine:database:drop --force --if-exists
47+
48+
## Database - Reset
49+
db.reset: db.drop db.install
50+
51+
## Database - Load data fixtures
52+
db.fixtures:
53+
symfony console doctrine:fixtures:load --no-interaction
54+
55+
# Database - Force update the database schema
56+
db.update-force: db.create
57+
symfony console doctrine:schema:update --force --complete
58+
59+
# Generate hash-password
60+
db.hash-password:
61+
symfony php bin/console security:hash-password
62+
63+
###############
64+
# Development #
65+
###############
66+
67+
## Dev - Start the whole application for development purposes
68+
serve:
69+
# https://www.npmjs.com/package/concurrently
70+
npx concurrently "make serve.docker" "make serve.php" --names="Docker,Symfony" --prefix=name --kill-others --kill-others-on-fail
71+
72+
## Dev - Start Symfony web server
73+
serve.php:
74+
symfony server:start --port=63280
75+
76+
## Dev - Start Docker services
77+
serve.docker:
78+
docker compose up
79+
80+
## Dev - Start Docker services in background
81+
serve.docker+detached:
82+
docker compose up -d
83+
84+
## Test - Start the whole application for test purposes (debug)
85+
serve@test:
86+
# https://www.npmjs.com/package/concurrently
87+
npx concurrently "make serve.docker" "make serve.php@test" --names="Docker,Symfony" --prefix=name --kill-others --kill-others-on-fail
88+
89+
serve.php@test: export APP_ENV = test
90+
serve.php@test: export APP_DEBUG = 1
91+
serve.php@test:
92+
symfony server:start --port=63290
93+
94+
## Stop Symfony web server
95+
stop.php:
96+
symfony server:stop
97+
98+
## Stop Docker services
99+
stop.docker:
100+
docker compose down
101+
102+
## Clear cache
103+
cache-clear:
104+
symfony console cache:clear
105+
106+
########
107+
# Lint #
108+
########
109+
110+
## Lint - Lint
111+
lint: lint.php-cs-fixer lint.phpstan lint.twig lint.yaml lint.container lint.doctrine lint.graphql lint.composer
112+
113+
lint.composer:
114+
symfony composer validate --no-check-publish
115+
116+
lint.container:
117+
symfony console lint:container
118+
119+
lint.doctrine:
120+
symfony console doctrine:schema:validate
121+
122+
lint.php-cs-fixer:
123+
symfony php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix
124+
125+
lint.twig:
126+
symfony console lint:twig templates --show-deprecations
127+
128+
lint.graphql:
129+
symfony console graphql:validate
130+
131+
lint.yaml:
132+
symfony console lint:yaml config translations --parse-tags
133+
134+
lint.phpstan:
135+
symfony console cache:clear --ansi
136+
symfony console cache:warmup --ansi
137+
symfony php vendor/bin/phpstan analyse --memory-limit=-1
138+
139+
############
140+
# Security #
141+
############
142+
143+
security.symfony:
144+
symfony check:security
145+
146+
password:
147+
symfony php bin/console security:hash-password
148+
149+
########
150+
# Test #
151+
########
152+
153+
## Test - Test
154+
test:
155+
symfony php bin/phpunit
156+
157+
## Test - Test & update deprecations baseline (see ./docs/res/tests.md)
158+
test.update-baseline: export UPDATE_DEPRECATIONS_BASELINE = 1
159+
test.update-baseline: test

0 commit comments

Comments
 (0)