├── .bitbucket
└── dependencies.sh
├── .circleci
└── config.yml
├── .dockerignore
├── .editorconfig
├── .env
├── .env.dev
├── .env.prod
├── .env.staging
├── .env.test
├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ └── ci.yml
├── .gitignore
├── .gitlab-ci.yml
├── .idea
├── .gitignore
├── PMDPlugin.xml
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── codeception.xml
├── htdocs.iml
├── inspectionProfiles
│ └── Project_Default.xml
├── laravel-idea.xml
├── misc.xml
├── modules.xml
├── php-docker-settings.xml
├── php.xml
├── phpspec.xml
├── phpunit.xml
├── symfony2.xml
├── vagrant.xml
└── vcs.xml
├── .php-cs-fixer.dist.php
├── Dockerfile
├── LICENSE
├── Makefile
├── assets
├── app.js
├── bootstrap.js
├── controllers.json
├── controllers
│ ├── csrf_protection_controller.js
│ └── hello_controller.js
└── styles
│ └── app.css
├── bin
└── console
├── bitbucket-pipelines.yml
├── compose-prod.yaml
├── compose-staging.yaml
├── compose-test-ci.yaml
├── compose.yaml
├── composer-unused.php
├── composer.json
├── composer.lock
├── config
├── bundles.php
├── packages
│ ├── asset_mapper.yaml
│ ├── cache.yaml
│ ├── debug.yaml
│ ├── dev
│ │ └── systemsdk_easy_log.yaml
│ ├── doctrine.yaml
│ ├── doctrine_migrations.yaml
│ ├── framework.yaml
│ ├── lock.yaml
│ ├── mailer.yaml
│ ├── messenger.yaml
│ ├── monolog.yaml
│ ├── notifier.yaml
│ ├── routing.yaml
│ ├── scheduler.yaml
│ ├── security.yaml
│ ├── test
│ │ └── systemsdk_easy_log.yaml
│ ├── translation.yaml
│ ├── twig.yaml
│ ├── validator.yaml
│ └── web_profiler.yaml
├── preload.php
├── routes.yaml
├── routes
│ ├── framework.yaml
│ ├── prod
│ │ └── annotations.yaml
│ ├── scheduler.yaml
│ ├── security.yaml
│ ├── staging
│ │ └── annotations.yaml
│ └── web_profiler.yaml
└── services.yaml
├── docker
├── dev
│ ├── init-db.sql
│ ├── nginx.conf
│ ├── php.ini
│ ├── www.conf
│ ├── xdebug-main.ini
│ └── xdebug-osx.ini
├── fish
│ ├── completions
│ │ ├── composer.fish
│ │ └── sf_console.fish
│ ├── config.fish
│ └── functions
│ │ └── console.fish
├── general
│ ├── cron
│ ├── do_we_need_xdebug.sh
│ └── supervisord.conf
├── nginx
│ └── Dockerfile
├── prod
│ ├── nginx.conf
│ ├── php.ini
│ └── www.conf
├── rabbitmq
│ ├── Dockerfile
│ └── rabbitmq_delayed_message_exchange-v4.0.7.ez
├── staging
│ ├── nginx.conf
│ ├── php.ini
│ └── www.conf
└── test
│ ├── nginx.conf
│ ├── php.ini
│ └── www.conf
├── docs
├── commands.md
├── development.md
├── images
│ ├── phpstorm_00.png
│ ├── phpstorm_01.png
│ ├── phpstorm_02.png
│ ├── phpstorm_03.png
│ ├── phpstorm_04.png
│ ├── phpstorm_05.png
│ ├── phpstorm_06.png
│ ├── phpstorm_12.png
│ ├── phpstorm_13.png
│ ├── phpstorm_code_style.png
│ ├── phpstorm_inspections.png
│ ├── phpstorm_php_code_sniffer_1.png
│ ├── phpstorm_php_code_sniffer_2.png
│ ├── phpstorm_php_cs_fixer_1.png
│ ├── phpstorm_php_cs_fixer_2.png
│ ├── phpstorm_phpmd_1.png
│ ├── phpstorm_phpmd_2.png
│ ├── phpstorm_phpstan_1.png
│ ├── phpstorm_phpstan_2.png
│ ├── postman_01.png
│ ├── xdebug_01.png
│ └── xdebug_02.png
├── messenger.md
├── phpstorm.md
├── phpstorm
│ ├── CodeStyle.xml
│ └── Inspections.xml
├── testing.md
└── xdebug.md
├── ecs.php
├── importmap.php
├── migrations
├── .gitignore
└── Version20190222213409.php
├── phpinsights.php
├── phpmd_ruleset.xml
├── phpstan.neon.dist
├── phpunit.xml.dist
├── public
├── check.php
├── favicon.ico
├── index.php
└── robots.txt
├── qodana.yaml
├── readme.md
├── rector.php
├── reports
└── .gitkeep
├── src
├── Command
│ └── WaitDatabaseCommand.php
├── Controller
│ └── .gitignore
├── DataFixtures
│ └── AppFixtures.php
├── Entity
│ └── .gitignore
├── Kernel.php
├── Message
│ ├── Interfaces
│ │ ├── MessageHighInterface.php
│ │ └── MessageLowInterface.php
│ └── TestMessage.php
├── MessageHandler
│ └── TestHandler.php
├── Repository
│ └── .gitignore
└── Service
│ ├── Interfaces
│ └── MessageServiceInterface.php
│ └── MessageService.php
├── symfony.lock
├── templates
├── Doctrine
│ └── migration.tpl
└── base.html.twig
├── tests
├── Application
│ └── ExampleTest.php
├── ApplicationTestCase.php
├── CreatesApplication.php
├── Integration
│ └── .gitkeep
├── Unit
│ └── ExampleTest.php
├── UnitTestCase.php
└── bootstrap.php
├── tools
├── 01_phpunit
│ ├── composer.json
│ └── composer.lock
├── 02_phpstan
│ ├── composer.json
│ └── composer.lock
├── 03_ecs
│ ├── composer.json
│ └── composer.lock
├── 04_php-coveralls
│ ├── composer.json
│ └── composer.lock
├── 05_phpinsights
│ ├── composer.json
│ └── composer.lock
├── 06_phpmd
│ ├── composer.json
│ └── composer.lock
├── 07_phpmetrics
│ ├── composer.json
│ └── composer.lock
├── 08_rector
│ ├── composer.json
│ └── composer.lock
├── 09_composer
│ ├── composer.json
│ └── composer.lock
└── 10_phpcpd
│ ├── composer.json
│ └── composer.lock
├── translations
└── .gitignore
└── var
└── .gitkeep
/.bitbucket/dependencies.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | set -eu
4 |
5 | # Add python pip and bash
6 | apk add --no-cache py-pip bash make
7 |
8 | # Install docker-compose via pip
9 | pip install --no-cache-dir docker-compose~=1.23.0
10 | docker-compose -v
11 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | jobs:
3 | build:
4 | working_directory: ~/html
5 | machine:
6 | image: ubuntu-2204:2023.04.2
7 | branches:
8 | ignore:
9 | - develop
10 | steps:
11 | - checkout
12 |
13 | - run:
14 | name: Start containers and verify it's working
15 | command: |
16 | make start-test
17 |
18 | - run:
19 | name: Wait for DB container is running and initialize DB & messenger component
20 | command: |
21 | make wait-for-db
22 | make drop-migrate
23 | make messenger-setup-transports
24 |
25 | - run:
26 | name: Show framework version and additional info, php & composer version
27 | command: |
28 | make info
29 |
30 | - run:
31 | name: Run unit/application tests
32 | command: |
33 | make phpunit
34 |
35 | - run:
36 | name: Report code coverage
37 | command: |
38 | make report-code-coverage
39 |
40 | - run:
41 | name: Checks for security vulnerability advisories for installed packages
42 | command: |
43 | make composer-audit
44 |
45 | - run:
46 | name: Check coding standard & CodeSniffer
47 | command: |
48 | make ecs
49 | make phpcs
50 |
51 | - run:
52 | name: Run PHPStan
53 | command: |
54 | make phpstan
55 |
56 | - run:
57 | name: Run PHPInsights
58 | command: |
59 | make phpinsights
60 |
61 | - run:
62 | name: Run PHP Mess Detector
63 | command: |
64 | make phpmd
65 |
66 | - run:
67 | name: Run PHP copy paste detector
68 | command: |
69 | make phpcpd
70 |
71 | - store_artifacts:
72 | path: reports
73 |
74 | - store_test_results:
75 | path: reports
76 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | ### User-specific stuff:
2 | /.git*
3 | /.idea/workspace.xml
4 | .dockerignore
5 |
6 | ###> symfony/framework-bundle ###
7 | /.env.local
8 | /.env.*.local
9 | /.env.local.php
10 | /public/bundles/
11 | /vendor/
12 | ###< symfony/framework-bundle ###
13 |
14 | ### Other data
15 | /var/mysql-data
16 | /var/rabbitmq
17 | /var/elasticsearch-data
18 | /var/redis
19 |
20 | ### Vendor bin dependencies
21 | /tools/*/vendor/
22 | .phpunit.cache
23 | .phpunit.result.cache
24 |
25 | ### Docker
26 | Dockerfile
27 | compose.yaml
28 | compose-test-ci.yaml
29 | compose-staging.yaml
30 | compose-prod.yaml
31 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | insert_final_newline = true
8 | indent_style = space
9 | indent_size = 4
10 | trim_trailing_whitespace = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
15 | [*.yml]
16 | indent_size = 2
17 |
18 | [{composer.json,Makefile}]
19 | indent_style = tab
20 |
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | # In all environments, the following files are loaded if they exist,
2 | # the latter taking precedence over the former:
3 | #
4 | # * .env contains default values for the environment variables needed by the app
5 | # * .env.local uncommitted file with local overrides
6 | # * .env.$APP_ENV committed environment-specific defaults
7 | # * .env.$APP_ENV.local uncommitted environment-specific overrides
8 | #
9 | # Real environment variables win over .env files.
10 | #
11 | # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12 | # https://symfony.com/doc/current/configuration/secrets.html
13 | #
14 | # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15 | # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16 |
17 | ###> docker compose configuration ###
18 | COMPOSE_PROJECT_NAME=environment1
19 | ###< docker compose configuration ###
20 |
21 | ###> NGinx docker configuration. Can be overridden in: .env.local, .env.staging, .env.prod. ###
22 | WEB_PORT_HTTP=80
23 | WEB_PORT_SSL=443
24 | ###< Nginx docker configuration ###
25 |
26 | ###> XDebug docker configuration. Can be overridden in: .env.local. ###
27 | # XDEBUG_CONFIG possible values: main|osx. Use main value for Linux and Windows, osx value for MacOS.
28 | XDEBUG_CONFIG=main
29 | # Sometimes we need to use different xdebug versions, list of versions can be found here - https://pecl.php.net/package/xdebug
30 | XDEBUG_VERSION=3.4.2
31 | ###< XDebug docker configuration ###
32 |
33 | ###> MySQL docker configuration. Can be overridden in: .env.local, .env.staging, .env.prod. ###
34 | # MySQL version, recommend values: 9.1.0|9.0.1|8.4.4|8.3.0|8.2.0|8.1.0|8.0.39
35 | MYSQL_VERSION=8.4.4
36 | # MySQL INNODB_USE_NATIVE_AIO possible values: 1|0. Set to 0 when AIO interface is not supported on OSX. https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_use_native_aio
37 | INNODB_USE_NATIVE_AIO=1
38 | # Sometimes AWS MySQL RDS has SQL_MODE="NO_ENGINE_SUBSTITUTION" (https://github.com/awsdocs/amazon-rds-user-guide/issues/160) but MySQL default described here - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode
39 | SQL_MODE="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
40 | MYSQL_ROOT_PASSWORD=secret
41 | MYSQL_PORT=33061
42 | ###< MySQL docker configuration ###
43 |
44 | ###> RabbitMQ docker configuration. Can be overridden in: .env.local, .env.staging, .env.prod. ###
45 | RABBITMQ_ERLANG_COOKIE=7ead507151fc4461b9f45c1161384a04
46 | RABBITMQ_USER=guest
47 | RABBITMQ_PASS=guest
48 | RABBITMQ_MANAGEMENT_PORT=15672
49 | ###< RabbitMQ docker configuration ###
50 |
51 | ###> symfony/framework-bundle ###
52 | APP_ENV=dev
53 | APP_DEBUG=1
54 | APP_SECRET=42f011ec3a7bde0bec87364b1d967193
55 | TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR
56 | #TRUSTED_HOSTS='^localhost|example\.com$'
57 | ###< symfony/framework-bundle ###
58 |
59 | ###> doctrine/doctrine-bundle ###
60 | # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
61 | # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
62 | #
63 | # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
64 | # DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
65 | DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/symfony
66 | ###< doctrine/doctrine-bundle ###
67 |
68 | ###> symfony/mailer ###
69 | MAILER_DSN=smtp://user:pass@mail:1025
70 | ###< symfony/mailer ###
71 |
72 | ###> symfony/messenger ###
73 | MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_USER}:${RABBITMQ_PASS}@rabbitmq:5672/%2f/messages
74 | ###< symfony/messenger ###
75 |
76 | ###> symfony/lock ###
77 | # Choose one of the stores below
78 | # postgresql+advisory://db_user:db_password@localhost/db_name
79 | LOCK_DSN=flock
80 | ###< symfony/lock ###
81 |
--------------------------------------------------------------------------------
/.env.dev:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/.env.dev
--------------------------------------------------------------------------------
/.env.prod:
--------------------------------------------------------------------------------
1 | # define your env variables for the prod env here
2 | MYSQL_ROOT_PASSWORD=secret
3 |
4 | RABBITMQ_ERLANG_COOKIE=7ead507151fc4461b9f45c1161384a04
5 | RABBITMQ_USER=guest
6 | RABBITMQ_PASS=guest
7 |
8 | APP_ENV=prod
9 | APP_SECRET=42f011ec3a7bde0bec87364b1d967194
10 | APP_DEBUG=0
11 |
12 | ###> doctrine/doctrine-bundle ###
13 | DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/symfony
14 | ###< doctrine/doctrine-bundle ###
15 |
16 | ###> symfony/mailer ###
17 | MAILER_DSN=smtp://user:pass@smtp.example.com?encryption=tls
18 | ###< symfony/mailer ###
19 |
20 | ###> symfony/messenger ###
21 | MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_USER}:${RABBITMQ_PASS}@rabbitmq:5672/%2f/messages
22 | ###< symfony/messenger ###
23 |
--------------------------------------------------------------------------------
/.env.staging:
--------------------------------------------------------------------------------
1 | # define your env variables for the staging env here
2 | MYSQL_ROOT_PASSWORD=secret
3 |
4 | RABBITMQ_ERLANG_COOKIE=7ead507151fc4461b9f45c1161384a04
5 | RABBITMQ_USER=guest
6 | RABBITMQ_PASS=guest
7 |
8 | APP_ENV=staging
9 | APP_SECRET=42f011ec3a7bde0bec87364b1d967194
10 | APP_DEBUG=0
11 |
12 | ###> doctrine/doctrine-bundle ###
13 | DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/symfony
14 | ###< doctrine/doctrine-bundle ###
15 |
16 | ###> symfony/mailer ###
17 | MAILER_DSN=smtp://user:pass@smtp.example.com?encryption=tls
18 | ###< symfony/mailer ###
19 |
20 | ###> symfony/messenger ###
21 | MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_USER}:${RABBITMQ_PASS}@rabbitmq:5672/%2f/messages
22 | ###< symfony/messenger ###
23 |
--------------------------------------------------------------------------------
/.env.test:
--------------------------------------------------------------------------------
1 | # define your env variables for the test env here
2 | APP_ENV=test
3 | KERNEL_CLASS='App\Kernel'
4 | APP_SECRET='$ecretf0rt3st'
5 | APP_DEBUG=0
6 | SYMFONY_DEPRECATIONS_HELPER=999999
7 |
8 | ###> doctrine/doctrine-bundle ###
9 | DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/symfony_testing
10 | ###< doctrine/doctrine-bundle ###
11 |
12 | ###> symfony/mailer ###
13 | MAILER_DSN=null://null
14 | ###< symfony/mailer ###
15 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 | docs/postman/symfony.postman_collection.json binary
7 | tools/**/composer.lock binary
8 | composer.lock binary
9 | symfony.lock binary
10 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ["https://www.paypal.com/donate/?hosted_button_id=4ZZHRZHENRPZN"]
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: Symfony App
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | - develop
8 | pull_request:
9 | branches:
10 | - master
11 | - develop
12 | release:
13 | types: [published]
14 |
15 | jobs:
16 | build:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/checkout@v4
20 | - name: Build the docker images
21 | run: make build-test
22 | - name: Start the docker images
23 | run: make start-test
24 | - name: Check running containers
25 | run: docker ps -a
26 | - name: Wait for database connection
27 | run: make wait-for-db
28 | - name: Run migrations
29 | run: make drop-migrate
30 | - name: Setup transports for Messenger component
31 | run: make messenger-setup-transports
32 | - name: Show framework version and additional info, php & composer version
33 | run: make info
34 | - name: Run test suite
35 | run: make phpunit
36 | - name: Archive coverage data for Qodana
37 | uses: actions/upload-artifact@v4
38 | with:
39 | name: php-coverage-data
40 | path: reports/clover.xml
41 | - name: Checks for security vulnerability advisories for installed packages
42 | run: make composer-audit
43 | - name: Run coding standard
44 | run: make ecs
45 | - name: Run codeSniffer
46 | run: make phpcs
47 | - name: Run PHPStan
48 | run: make phpstan
49 | - name: Run PHPInsights
50 | run: make phpinsights
51 | - name: Run php mess detector
52 | run: make phpmd
53 | - name: Run php copy paste detector
54 | run: make phpcpd
55 | - name: Stop the docker images
56 | run: make stop-test
57 |
58 | # Currently local Qodana report differ from CI Qodana report due to some issues https://youtrack.jetbrains.com/issue/QD-7379
59 | # qodana:
60 | # runs-on: ubuntu-20.04
61 | # needs: build
62 | # permissions:
63 | # contents: write
64 | # pull-requests: write
65 | # checks: write
66 | # steps:
67 | # - uses: actions/checkout@v4
68 | # with:
69 | # ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
70 | # fetch-depth: 0 # a full history is required for pull request analysis
71 | # php-version: '8.3'
72 | # - name: 'Install dependencies'
73 | # run: COMPOSER_MEMORY_LIMIT=-1 composer install
74 | # - name: 'Download coverage data for Qodana'
75 | # uses: actions/download-artifact@v4
76 | # with:
77 | # name: php-coverage-data
78 | # path: .qodana/code-coverage
79 | # - name: 'Qodana Scan'
80 | # uses: JetBrains/qodana-action@v2023.2
81 | # env:
82 | # QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
83 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | reports/*
2 | !reports/.gitkeep
3 |
4 | ###> symfony/framework-bundle ###
5 | /.env.local
6 | /.env.local.php
7 | /.env.*.local
8 | /config/secrets/prod/prod.decrypt.private.php
9 | /public/bundles/
10 | /var/*
11 | !var/.gitkeep
12 | /vendor/
13 | /tools/**/vendor
14 | ###< symfony/framework-bundle ###
15 |
16 | ###> symfony/phpunit-bridge ###
17 | .phpunit
18 | .phpunit.result.cache
19 | /phpunit.xml
20 | .phpunit.cache
21 | ###< symfony/phpunit-bridge ###
22 |
23 | ###> symfony/asset-mapper ###
24 | /public/assets/
25 | /assets/vendor/
26 | ###< symfony/asset-mapper ###
27 |
28 | ###> friendsofphp/php-cs-fixer ###
29 | .php-cs-fixer.cache
30 | .php_cs
31 | .php_cs.cache
32 | ###< friendsofphp/php-cs-fixer ###
33 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | image: docker:latest
2 |
3 | variables:
4 | DOCKER_DRIVER: overlay2
5 | DOCKER_TLS_CERTDIR: ""
6 | GITLAB_CI: 1
7 |
8 | services:
9 | - docker:dind
10 |
11 | before_script:
12 | - apk update
13 | - apk upgrade
14 | - apk add --no-cache make bash docker-compose && rm -rf /var/cache/apk/*
15 |
16 | stages:
17 | - build
18 | - deploy
19 |
20 | .general_scripts: &general_scripts
21 | - make info
22 |
23 | build:
24 | stage: build
25 | script:
26 | - make build-test
27 | - make start-test
28 | - docker ps -a
29 | - make wait-for-db
30 | - make drop-migrate
31 | - make messenger-setup-transports
32 | - *general_scripts
33 | - make phpunit
34 | - make composer-audit
35 | - make ecs
36 | - make phpcs
37 | - make phpstan
38 | - make phpinsights
39 | - make phpmd
40 | - make phpcpd
41 | - make stop-test
42 | artifacts:
43 | paths:
44 | - reports/
45 | only:
46 | - merge_requests
47 | - tags
48 | - master
49 | - develop
50 |
51 | push_staging_images:
52 | stage: deploy
53 | script:
54 | - make build-staging
55 | # TODO: set necessary image name in compose-staging.yaml according to your registry and edit lines bellow
56 | #- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
57 | #- docker compose -f compose-staging.yaml push
58 | only:
59 | - master
60 | - develop
61 | - /^release.*$/
62 |
63 | push_prod_images:
64 | stage: deploy
65 | script:
66 | - make build-prod
67 | # TODO: set necessary image name in compose-prod.yaml according to your registry and edit lines bellow
68 | #- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
69 | #- docker compose -f compose-prod.yaml push
70 | only:
71 | - master
72 | - /^release.*$/
73 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /dictionaries/
3 | /shelf/
4 | /workspace.xml
5 | # Editor-based HTTP Client requests
6 | /httpRequests/
7 | # Datasource local storage ignored files
8 | /dataSources/
9 | /dataSources.local.xml
10 |
--------------------------------------------------------------------------------
/.idea/PMDPlugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/codeception.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
29 |
30 |
--------------------------------------------------------------------------------
/.idea/laravel-idea.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/php-docker-settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/phpspec.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.idea/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/symfony2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/vagrant.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.php-cs-fixer.dist.php:
--------------------------------------------------------------------------------
1 | in(__DIR__)
8 | ->exclude('somedir');
9 |
10 | return (new PhpCsFixer\Config())
11 | ->setRules([
12 | '@Symfony' => true,
13 | 'array_syntax' => ['syntax' => 'short'],
14 | 'increment_style' => ['style' => 'post'],
15 | 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
16 | 'concat_space' => ['spacing' => 'one'],
17 | 'cast_spaces' => ['space' => 'none'],
18 | 'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
19 | 'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => false, 'allow_mixed' => true, 'allow_unused_params' => true],
20 | 'declare_equal_normalize' => ['space' => 'none'],
21 | 'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
22 | 'single_blank_line_before_namespace' => true,
23 | 'blank_line_after_namespace' => true,
24 | 'phpdoc_align' => ['align' => 'left'],
25 | 'types_spaces' => 'single',
26 |
27 | // skip list (see ecs.php)
28 | 'no_multiline_whitespace_around_double_arrow' => false,
29 | 'phpdoc_no_package' => false,
30 | 'phpdoc_summary' => false,
31 | 'phpdoc_separation' => false,
32 | 'blank_line_after_opening_tag' => false,
33 | 'class_attributes_separation' => false,
34 | 'no_blank_lines_before_namespace' => false,
35 | 'not_operator_with_successor_space' => false,
36 | 'single_line_throw' => false,
37 | 'no_extra_blank_lines' => ['tokens' => ['break']],
38 | ])
39 | ->setFinder($finder);
40 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # syntax=docker/dockerfile:1.7-labs
2 | FROM php:8.4-fpm
3 |
4 | # set main params
5 | ARG BUILD_ARGUMENT_ENV=dev
6 | ENV ENV=$BUILD_ARGUMENT_ENV
7 | ENV APP_HOME /var/www/html
8 | ARG HOST_UID=1000
9 | ARG HOST_GID=1000
10 | ENV USERNAME=www-data
11 | ARG INSIDE_DOCKER_CONTAINER=1
12 | ENV INSIDE_DOCKER_CONTAINER=$INSIDE_DOCKER_CONTAINER
13 | ARG XDEBUG_CONFIG=main
14 | ENV XDEBUG_CONFIG=$XDEBUG_CONFIG
15 | ARG XDEBUG_VERSION=3.4.2
16 | ENV XDEBUG_VERSION=$XDEBUG_VERSION
17 | ENV PHP_CS_FIXER_IGNORE_ENV=1
18 |
19 | # check environment
20 | RUN if [ "$BUILD_ARGUMENT_ENV" = "default" ]; then echo "Set BUILD_ARGUMENT_ENV in docker build-args like --build-arg BUILD_ARGUMENT_ENV=dev" && exit 2; \
21 | elif [ "$BUILD_ARGUMENT_ENV" = "dev" ]; then echo "Building development environment."; \
22 | elif [ "$BUILD_ARGUMENT_ENV" = "test" ]; then echo "Building test environment."; \
23 | elif [ "$BUILD_ARGUMENT_ENV" = "staging" ]; then echo "Building staging environment."; \
24 | elif [ "$BUILD_ARGUMENT_ENV" = "prod" ]; then echo "Building production environment."; \
25 | else echo "Set correct BUILD_ARGUMENT_ENV in docker build-args like --build-arg BUILD_ARGUMENT_ENV=dev. Available choices are dev,test,staging,prod." && exit 2; \
26 | fi
27 |
28 | # install all the dependencies and enable PHP modules
29 | RUN apt-get update && apt-get upgrade -y && apt-get install -y \
30 | bash-completion \
31 | fish \
32 | procps \
33 | nano \
34 | git \
35 | unzip \
36 | libicu-dev \
37 | zlib1g-dev \
38 | libxml2 \
39 | libxml2-dev \
40 | libreadline-dev \
41 | supervisor \
42 | cron \
43 | sudo \
44 | libzip-dev \
45 | wget \
46 | librabbitmq-dev \
47 | debsecan \
48 | xalan \
49 | && pecl install amqp \
50 | && docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
51 | && docker-php-ext-configure intl \
52 | && docker-php-ext-install \
53 | pdo_mysql \
54 | sockets \
55 | intl \
56 | opcache \
57 | zip \
58 | && docker-php-ext-enable amqp \
59 | && apt-get install --no-install-recommends -y \
60 | $(debsecan --suite bookworm --format packages --only-fixed) \
61 | && rm -rf /tmp/* \
62 | && rm -rf /var/list/apt/* \
63 | && rm -rf /var/lib/apt/lists/* \
64 | && apt-get clean
65 |
66 | # create document root, fix permissions for www-data user and change owner to www-data
67 | RUN mkdir -p $APP_HOME/public && \
68 | mkdir -p /home/$USERNAME && chown $USERNAME:$USERNAME /home/$USERNAME \
69 | && usermod -o -u $HOST_UID $USERNAME -d /home/$USERNAME \
70 | && groupmod -o -g $HOST_GID $USERNAME \
71 | && chown -R ${USERNAME}:${USERNAME} $APP_HOME
72 |
73 | # put php config for Symfony
74 | COPY ./docker/$BUILD_ARGUMENT_ENV/www.conf /usr/local/etc/php-fpm.d/www.conf
75 | COPY ./docker/$BUILD_ARGUMENT_ENV/php.ini /usr/local/etc/php/php.ini
76 |
77 | # install Xdebug in case dev/test environment
78 | COPY ./docker/general/do_we_need_xdebug.sh /tmp/
79 | COPY ./docker/dev/xdebug-${XDEBUG_CONFIG}.ini /tmp/xdebug.ini
80 | RUN chmod u+x /tmp/do_we_need_xdebug.sh && /tmp/do_we_need_xdebug.sh
81 |
82 | # install composer
83 | COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
84 | RUN chmod +x /usr/bin/composer
85 | ENV COMPOSER_ALLOW_SUPERUSER 1
86 |
87 | # Enable Composer autocompletion
88 | RUN composer completion bash > /etc/bash_completion.d/composer
89 |
90 | # add supervisor
91 | RUN mkdir -p /var/log/supervisor
92 | COPY --chown=root:root ./docker/general/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
93 | COPY --chown=root:crontab ./docker/general/cron /var/spool/cron/crontabs/root
94 | RUN chmod 0600 /var/spool/cron/crontabs/root
95 |
96 | # set working directory
97 | WORKDIR $APP_HOME
98 |
99 | USER ${USERNAME}
100 |
101 | # Add necessary stuff to bash autocomplete
102 | RUN echo 'source /usr/share/bash-completion/bash_completion' >> /home/${USERNAME}/.bashrc \
103 | && echo 'alias console="/var/www/html/bin/console"' >> /home/${USERNAME}/.bashrc
104 |
105 | # copy fish configs
106 | COPY --chown=${USERNAME}:${USERNAME} ./docker/fish/completions/ /home/${USERNAME}/.config/fish/completions/
107 | COPY --chown=${USERNAME}:${USERNAME} ./docker/fish/functions/ /home/${USERNAME}/.config/fish/functions/
108 | COPY --chown=${USERNAME}:${USERNAME} ./docker/fish/config.fish /home/${USERNAME}/.config/fish/config.fish
109 |
110 | # copy source files
111 | COPY --chown=${USERNAME}:${USERNAME} . $APP_HOME/
112 |
113 | # install all PHP dependencies
114 | RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; \
115 | else export APP_ENV=$BUILD_ARGUMENT_ENV && COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
116 | fi
117 |
118 | # create cached config file .env.local.php in case staging/prod environment
119 | RUN if [ "$BUILD_ARGUMENT_ENV" = "staging" ] || [ "$BUILD_ARGUMENT_ENV" = "prod" ]; then composer dump-env $BUILD_ARGUMENT_ENV; \
120 | fi
121 |
122 | USER root
123 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) Dmitriy Kravtsov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/assets/app.js:
--------------------------------------------------------------------------------
1 | import './bootstrap.js';
2 | /*
3 | * Welcome to your app's main JavaScript file!
4 | *
5 | * This file will be included onto the page via the importmap() Twig function,
6 | * which should already be in your base.html.twig.
7 | */
8 | import './styles/app.css';
9 |
10 | console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
11 |
--------------------------------------------------------------------------------
/assets/bootstrap.js:
--------------------------------------------------------------------------------
1 | import { startStimulusApp } from '@symfony/stimulus-bundle';
2 |
3 | const app = startStimulusApp();
4 | // register any custom, 3rd party controllers here
5 | // app.register('some_controller_name', SomeImportedController);
6 |
--------------------------------------------------------------------------------
/assets/controllers.json:
--------------------------------------------------------------------------------
1 | {
2 | "controllers": {
3 | "@symfony/ux-turbo": {
4 | "turbo-core": {
5 | "enabled": true,
6 | "fetch": "eager"
7 | },
8 | "mercure-turbo-stream": {
9 | "enabled": false,
10 | "fetch": "eager"
11 | }
12 | }
13 | },
14 | "entrypoints": []
15 | }
16 |
--------------------------------------------------------------------------------
/assets/controllers/csrf_protection_controller.js:
--------------------------------------------------------------------------------
1 | const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;
2 | const tokenCheck = /^[-_\/+a-zA-Z0-9]{24,}$/;
3 |
4 | // Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager
5 | document.addEventListener('submit', function (event) {
6 | generateCsrfToken(event.target);
7 | }, true);
8 |
9 | // When @hotwired/turbo handles form submissions, send the CSRF token in a header in addition to a cookie
10 | // The `framework.csrf_protection.check_header` config option needs to be enabled for the header to be checked
11 | document.addEventListener('turbo:submit-start', function (event) {
12 | const h = generateCsrfHeaders(event.detail.formSubmission.formElement);
13 | Object.keys(h).map(function (k) {
14 | event.detail.formSubmission.fetchRequest.headers[k] = h[k];
15 | });
16 | });
17 |
18 | // When @hotwired/turbo handles form submissions, remove the CSRF cookie once a form has been submitted
19 | document.addEventListener('turbo:submit-end', function (event) {
20 | removeCsrfToken(event.detail.formSubmission.formElement);
21 | });
22 |
23 | export function generateCsrfToken (formElement) {
24 | const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
25 |
26 | if (!csrfField) {
27 | return;
28 | }
29 |
30 | let csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
31 | let csrfToken = csrfField.value;
32 |
33 | if (!csrfCookie && nameCheck.test(csrfToken)) {
34 | csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);
35 | csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));
36 | csrfField.dispatchEvent(new Event('change', { bubbles: true }));
37 | }
38 |
39 | if (csrfCookie && tokenCheck.test(csrfToken)) {
40 | const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';
41 | document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;
42 | }
43 | }
44 |
45 | export function generateCsrfHeaders (formElement) {
46 | const headers = {};
47 | const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
48 |
49 | if (!csrfField) {
50 | return headers;
51 | }
52 |
53 | const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
54 |
55 | if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {
56 | headers[csrfCookie] = csrfField.value;
57 | }
58 |
59 | return headers;
60 | }
61 |
62 | export function removeCsrfToken (formElement) {
63 | const csrfField = formElement.querySelector('input[data-controller="csrf-protection"], input[name="_csrf_token"]');
64 |
65 | if (!csrfField) {
66 | return;
67 | }
68 |
69 | const csrfCookie = csrfField.getAttribute('data-csrf-protection-cookie-value');
70 |
71 | if (tokenCheck.test(csrfField.value) && nameCheck.test(csrfCookie)) {
72 | const cookie = csrfCookie + '_' + csrfField.value + '=0; path=/; samesite=strict; max-age=0';
73 |
74 | document.cookie = window.location.protocol === 'https:' ? '__Host-' + cookie + '; secure' : cookie;
75 | }
76 | }
77 |
78 | /* stimulusFetch: 'lazy' */
79 | export default 'csrf-protection-controller';
80 |
--------------------------------------------------------------------------------
/assets/controllers/hello_controller.js:
--------------------------------------------------------------------------------
1 | import { Controller } from '@hotwired/stimulus';
2 |
3 | /*
4 | * This is an example Stimulus controller!
5 | *
6 | * Any element with a data-controller="hello" attribute will cause
7 | * this controller to be executed. The name "hello" comes from the filename:
8 | * hello_controller.js -> "hello"
9 | *
10 | * Delete this file or adapt it for your use!
11 | */
12 | export default class extends Controller {
13 | connect() {
14 | this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/assets/styles/app.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: skyblue;
3 | }
4 |
--------------------------------------------------------------------------------
/bin/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | addPatternFilter(PatternFilter::fromString('/ext-.*/'))
13 | ->addNamedFilter(NamedFilter::fromString('doctrine/doctrine-migrations-bundle'))
14 | ->addNamedFilter(NamedFilter::fromString('dukecity/command-scheduler-bundle'))
15 | ->addNamedFilter(NamedFilter::fromString('phpdocumentor/reflection-docblock'))
16 | ->addNamedFilter(NamedFilter::fromString('nelmio/cors-bundle'))
17 | ->addPatternFilter(PatternFilter::fromString('/symfony\/.*/'))
18 | ->addNamedFilter(NamedFilter::fromString('twig/extra-bundle'))
19 | ->setAdditionalFilesFor('icanhazstring/composer-unused', [
20 | __FILE__,
21 | ...Glob::glob(__DIR__ . '/config/*.php'),
22 | ]);
23 | };
24 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony",
3 | "type": "project",
4 | "description": "Docker symfony environment",
5 | "keywords": [
6 | "Docker",
7 | "Nginx",
8 | "Php",
9 | "Symfony",
10 | "Supervisord",
11 | "MySQL",
12 | "RabbitMQ"
13 | ],
14 | "homepage": "https://github.com/systemsdk/docker-nginx-php-symfony",
15 | "license": "MIT",
16 | "authors": [
17 | {
18 | "name": "Dmitriy Kravtsov",
19 | "email": "dmytro.kravtsov@systemsdk.com",
20 | "homepage": "https://github.com/systemsdk",
21 | "role": "Developer"
22 | }
23 | ],
24 | "require": {
25 | "php": "^8.4.0",
26 | "ext-amqp": "*",
27 | "ext-ctype": "*",
28 | "ext-iconv": "*",
29 | "ext-json": "*",
30 | "ext-mbstring": "*",
31 | "ext-hash": "*",
32 | "ext-openssl": "*",
33 | "ext-pdo": "*",
34 | "ext-pdo_mysql": "*",
35 | "doctrine/annotations": "^2.0.2",
36 | "doctrine/doctrine-bundle": "^2.14.0",
37 | "doctrine/doctrine-migrations-bundle": "^3.4.1",
38 | "doctrine/orm": "^2.20.3",
39 | "phpdocumentor/reflection-docblock": "^5.6.2",
40 | "dukecity/command-scheduler-bundle": "^6.0.4",
41 | "symfony/amqp-messenger": "7.2.*",
42 | "symfony/asset": "7.2.*",
43 | "symfony/asset-mapper": "7.2.*",
44 | "symfony/config": "7.2.*",
45 | "symfony/console": "7.2.*",
46 | "symfony/doctrine-bridge": "7.2.*",
47 | "symfony/doctrine-messenger": "7.2.*",
48 | "symfony/dotenv": "7.2.*",
49 | "symfony/expression-language": "7.2.*",
50 | "symfony/flex": "^2.5.0",
51 | "symfony/form": "7.2.*",
52 | "symfony/framework-bundle": "7.2.*",
53 | "symfony/http-client": "7.2.*",
54 | "symfony/intl": "7.2.*",
55 | "symfony/mailer": "7.2.*",
56 | "symfony/messenger": "7.2.*",
57 | "symfony/mime": "7.2.*",
58 | "symfony/monolog-bundle": "^3.10",
59 | "symfony/notifier": "7.2.*",
60 | "symfony/process": "7.2.*",
61 | "symfony/property-access": "7.2.*",
62 | "symfony/property-info": "7.2.*",
63 | "symfony/proxy-manager-bridge": "6.4.*",
64 | "symfony/runtime": "7.2.*",
65 | "symfony/routing": "7.2.*",
66 | "symfony/security-bundle": "7.2.*",
67 | "symfony/serializer": "7.2.*",
68 | "symfony/stimulus-bundle": "^2.24.0",
69 | "symfony/string": "7.2.*",
70 | "symfony/translation": "7.2.*",
71 | "symfony/twig-bundle": "7.2.*",
72 | "symfony/ux-turbo": "^2.24.0",
73 | "symfony/validator": "7.2.*",
74 | "symfony/web-link": "7.2.*",
75 | "symfony/yaml": "7.2.*",
76 | "twig/extra-bundle": "^2.12|^3.21",
77 | "twig/twig": "^2.12|^3.21.1"
78 | },
79 | "conflict": {
80 | "symfony/debug": "<3.3",
81 | "symfony/symfony": "*",
82 | "symfony/twig-bundle": "<3.3"
83 | },
84 | "require-dev": {
85 | "bamarni/composer-bin-plugin": "^1.8.2",
86 | "doctrine/doctrine-fixtures-bundle": "^4.1",
87 | "systemsdk/easy-log-bundle": "2.0.*",
88 | "roave/security-advisories": "dev-latest",
89 | "symfony/browser-kit": "7.2.*",
90 | "symfony/debug-bundle": "7.2.*",
91 | "symfony/maker-bundle": "^1.63.0",
92 | "symfony/requirements-checker": "^2.0.3",
93 | "symfony/stopwatch": "7.2.*",
94 | "symfony/var-dumper": "7.2.*",
95 | "symfony/web-profiler-bundle": "7.2.*"
96 | },
97 | "replace": {
98 | "symfony/polyfill-ctype": "*",
99 | "symfony/polyfill-mbstring": "*",
100 | "symfony/polyfill-iconv": "*",
101 | "symfony/polyfill-php72": "*",
102 | "symfony/polyfill-php73": "*",
103 | "symfony/polyfill-php74": "*",
104 | "symfony/polyfill-php80": "*",
105 | "symfony/polyfill-php81": "*",
106 | "symfony/polyfill-php82": "*"
107 | },
108 | "config": {
109 | "allow-plugins": true,
110 | "platform": {
111 | "php": "8.4.0"
112 | },
113 | "preferred-install": {
114 | "*": "dist"
115 | },
116 | "bump-after-update": true,
117 | "sort-packages": true
118 | },
119 | "extra": {
120 | "allow-contrib": "true",
121 | "bamarni-bin": {
122 | "bin-links": true,
123 | "forward-command": true,
124 | "target-directory": "tools"
125 | },
126 | "symfony": {
127 | "allow-contrib": true,
128 | "require": "7.2.*"
129 | }
130 | },
131 | "autoload": {
132 | "psr-4": {
133 | "App\\": "src/"
134 | },
135 | "classmap": [],
136 | "exclude-from-classmap": []
137 | },
138 | "autoload-dev": {
139 | "psr-4": {
140 | "App\\Tests\\": "tests/",
141 | "PHPUnit\\": "tools/01_phpunit/vendor/phpunit/phpunit/src",
142 | "Symfony\\Bridge\\PhpUnit\\": "tools/01_phpunit/vendor/symfony/phpunit-bridge",
143 | "PHPMD\\": "tools/06_phpmd/vendor/phpmd/phpmd/src/bin",
144 | "Systemsdk\\PhpCPD\\": "tools/10_phpcpd/vendor/systemsdk/phpcpd/src",
145 | "PhpCsFixer\\": "tools/03_ecs/vendor/symplify/easy-coding-standard/vendor/friendsofphp/php-cs-fixer/src",
146 | "PHP_CodeSniffer\\": "tools/03_ecs/vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/src",
147 | "Symplify\\CodingStandard\\": "tools/03_ecs/vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/src",
148 | "Symplify\\EasyCodingStandard\\": "tools/03_ecs/vendor/symplify/easy-coding-standard/src",
149 | "ECSPrefix20210928\\Symplify\\RuleDocGenerator\\": "tools/03_ecs/vendor/symplify/easy-coding-standard/vendor/symplify/rule-doc-generator-contracts/src",
150 | "PHPStan\\PhpDoc\\PHPUnit\\": "tools/02_phpstan/vendor/phpstan/phpstan-phpunit/src/PhpDoc/PHPUnit",
151 | "PHPStan\\Rules\\PHPUnit\\": "tools/02_phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit",
152 | "PHPStan\\Symfony\\": "tools/02_phpstan/vendor/phpstan/phpstan-symfony/src/Symfony",
153 | "PHPStan\\Type\\PHPUnit\\": "tools/02_phpstan/vendor/phpstan/phpstan-phpunit/src/Type/PHPUnit",
154 | "PHPStan\\Type\\Symfony\\": "tools/02_phpstan/vendor/phpstan/phpstan-symfony/src/Type/Symfony",
155 | "Rector\\": "tools/08_rector/vendor/rector"
156 | }
157 | },
158 | "prefer-stable": true,
159 | "scripts": {
160 | "post-install-cmd": [
161 | "if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
162 | "if test -d vendor/bamarni/composer-bin-plugin; then composer bin all install; fi",
163 | "@auto-scripts",
164 | "@composer dump-autoload"
165 | ],
166 | "post-update-cmd": [
167 | "if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
168 | "if test -d vendor/bamarni/composer-bin-plugin; then composer bin all update; fi",
169 | "@auto-scripts",
170 | "@composer dump-autoload"
171 | ],
172 | "auto-scripts": {
173 | "cache:clear": "symfony-cmd",
174 | "cache:warmup": "symfony-cmd",
175 | "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
176 | "assets:install %PUBLIC_DIR%": "symfony-cmd",
177 | "importmap:install": "symfony-cmd"
178 | }
179 | },
180 | "support": {
181 | "issues": "https://github.com/systemsdk/docker-nginx-php-symfony/issues"
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/config/bundles.php:
--------------------------------------------------------------------------------
1 | ['all' => true],
5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
7 | Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
8 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
9 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
10 | Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
11 | Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
12 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
13 | Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
14 | Systemsdk\Bundle\EasyLogBundle\EasyLogBundle::class => ['dev' => true, 'test' => true],
15 | Dukecity\CommandSchedulerBundle\DukecityCommandSchedulerBundle::class => ['all' => true],
16 | Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
17 | Knp\Bundle\TimeBundle\KnpTimeBundle::class => ['all' => true],
18 | Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
19 | Symfony\UX\Turbo\TurboBundle::class => ['all' => true],
20 | ];
21 |
--------------------------------------------------------------------------------
/config/packages/asset_mapper.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | asset_mapper:
3 | # The paths to make available to the asset mapper.
4 | paths:
5 | - assets/
6 | missing_import_mode: strict
7 |
8 | when@prod:
9 | framework:
10 | asset_mapper:
11 | missing_import_mode: warn
12 |
--------------------------------------------------------------------------------
/config/packages/cache.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | cache:
3 | # Unique name of your app: used to compute stable namespaces for cache keys.
4 | prefix_seed: systemsdk/docker-nginx-php-symfony
5 |
6 | # The "app" cache stores to the filesystem by default.
7 | # The data in this cache should persist between deploys.
8 | # Other options include:
9 |
10 | # Redis
11 | #app: cache.adapter.redis
12 | #default_redis_provider: redis://localhost
13 |
14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
15 | #app: cache.adapter.apcu
16 |
17 | # Namespaced pools use the above "app" backend by default
18 | #pools:
19 | #my.dedicated.cache: null
20 |
--------------------------------------------------------------------------------
/config/packages/debug.yaml:
--------------------------------------------------------------------------------
1 | when@dev:
2 | debug:
3 | # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
4 | # See the "server:dump" command to start a new server.
5 | dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
6 |
--------------------------------------------------------------------------------
/config/packages/dev/systemsdk_easy_log.yaml:
--------------------------------------------------------------------------------
1 | easy_log:
2 | log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
3 | max_line_length: 120
4 | prefix_length: 2
5 | ignored_routes: ['_wdt', '_profiler']
6 |
--------------------------------------------------------------------------------
/config/packages/doctrine.yaml:
--------------------------------------------------------------------------------
1 | doctrine:
2 | dbal:
3 | # configure these for your database server
4 | driver: 'pdo_mysql'
5 | server_version: '%env(resolve:MYSQL_VERSION)%'
6 | charset: utf8mb4
7 | default_table_options:
8 | charset: utf8mb4
9 | collate: utf8mb4_unicode_ci
10 |
11 | # https://symfony.com/doc/current/messenger.html#doctrine-transport
12 | schema_filter: '~^(?!messenger_messages)~'
13 | url: '%env(resolve:DATABASE_URL)%'
14 | profiling_collect_backtrace: '%kernel.debug%'
15 | use_savepoints: true
16 |
17 | orm:
18 | auto_generate_proxy_classes: true
19 | enable_lazy_ghost_objects: true
20 | report_fields_where_declared: true
21 | naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
22 | auto_mapping: true
23 | validate_xml_mapping: true
24 | mappings:
25 | App:
26 | type: attribute
27 | is_bundle: false
28 | dir: '%kernel.project_dir%/src/Entity'
29 | prefix: 'App\Entity'
30 | alias: App
31 | controller_resolver:
32 | auto_mapping: false
33 |
34 | when@prod: ¬-dev
35 | dbal:
36 | logging: false
37 | doctrine:
38 | orm:
39 | auto_generate_proxy_classes: false
40 | proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
41 | query_cache_driver:
42 | type: pool
43 | pool: doctrine.system_cache_pool
44 | result_cache_driver:
45 | type: pool
46 | pool: doctrine.result_cache_pool
47 |
48 | framework:
49 | cache:
50 | pools:
51 | doctrine.result_cache_pool:
52 | adapter: cache.app
53 | doctrine.system_cache_pool:
54 | adapter: cache.system
55 |
56 | when@staging: *not-dev
57 |
58 | when@test:
59 | doctrine:
60 | dbal:
61 | logging: false
62 |
--------------------------------------------------------------------------------
/config/packages/doctrine_migrations.yaml:
--------------------------------------------------------------------------------
1 | doctrine_migrations:
2 | migrations_paths:
3 | # namespace is arbitrary but should be different from App\Migrations
4 | # as migrations classes should NOT be autoloaded
5 | 'DoctrineMigrations': '%kernel.project_dir%/migrations'
6 | enable_profiler: '%kernel.debug%'
7 | storage:
8 | table_storage:
9 | table_name: 'migration_versions'
10 | version_column_name: 'version'
11 | version_column_length: 512
12 | executed_at_column_name: 'executed_at'
13 | all_or_nothing: false
14 | custom_template: '%kernel.project_dir%/templates/Doctrine/migration.tpl'
15 |
--------------------------------------------------------------------------------
/config/packages/framework.yaml:
--------------------------------------------------------------------------------
1 | # see https://symfony.com/doc/current/reference/configuration/framework.html
2 | framework:
3 | secret: '%env(APP_SECRET)%'
4 | csrf_protection: false
5 | annotations: false
6 | http_method_override: false
7 | handle_all_throwables: true
8 | default_locale: '%locale%'
9 |
10 | # see https://symfony.com/doc/current/deployment/proxies.html
11 | trusted_proxies: '%env(TRUSTED_PROXIES)%'
12 | trusted_headers: [ 'x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix' ]
13 |
14 | translator:
15 | default_path: '%kernel.project_dir%/translations'
16 |
17 | serializer:
18 | enable_attributes: true
19 |
20 | php_errors:
21 | log: true
22 |
23 | # Enables session support. Note that the session will ONLY be started if you read or write from it.
24 | # Remove or comment this section to explicitly disable session support.
25 | session:
26 | handler_id: null
27 | cookie_secure: auto
28 | cookie_samesite: lax
29 | storage_factory_id: session.storage.factory.native
30 |
31 | #esi: true
32 | #fragments: true
33 |
34 | when@test:
35 | framework:
36 | test: true
37 | profiler:
38 | collect: false
39 | session:
40 | storage_factory_id: session.storage.factory.mock_file
41 |
--------------------------------------------------------------------------------
/config/packages/lock.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | lock: '%env(LOCK_DSN)%'
3 |
--------------------------------------------------------------------------------
/config/packages/mailer.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | mailer:
3 | dsn: '%env(MAILER_DSN)%'
4 |
--------------------------------------------------------------------------------
/config/packages/messenger.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | messenger:
3 | buses:
4 | command_bus:
5 | middleware:
6 | # each time a message is handled, the Doctrine connection
7 | # is "pinged" and reconnected if it's closed. Useful
8 | # if your workers run for a long time and the database
9 | # connection is sometimes lost
10 | - doctrine_ping_connection
11 |
12 | # After handling, the Doctrine connection is closed,
13 | # which can free up database connections in a worker,
14 | # instead of keeping them open forever
15 | - doctrine_close_connection
16 |
17 | # wraps all handlers in a single Doctrine transaction
18 | # handlers do not need to call flush() and an error
19 | # in any handler will cause a rollback
20 | #- doctrine_transaction
21 |
22 | # or pass a different entity manager to any
23 | #- doctrine_transaction: ['custom']
24 |
25 | # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
26 | failure_transport: failed
27 |
28 | transports:
29 | async_priority_high:
30 | dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
31 | options:
32 | exchange:
33 | name: high
34 | queues:
35 | messages_high: ~
36 | # default configuration
37 | retry_strategy:
38 | max_retries: 3
39 | # milliseconds delay
40 | delay: 5000
41 | # causes the delay to be higher before each retry
42 | # e.g. 1 second delay, 2 seconds, 4 seconds
43 | multiplier: 2
44 | max_delay: 0
45 | async_priority_low:
46 | dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
47 | options:
48 | exchange:
49 | name: low
50 | queues:
51 | messages_low: ~
52 | # default configuration
53 | retry_strategy:
54 | max_retries: 3
55 | # milliseconds delay
56 | delay: 5000
57 | # causes the delay to be higher before each retry
58 | # e.g. 1 second delay, 2 seconds, 4 seconds
59 | multiplier: 2
60 | max_delay: 0
61 |
62 | # Uncomment the following line to enable a transport named "amqp"
63 | # async: '%env(MESSENGER_TRANSPORT_DSN)%'
64 | failed: 'doctrine://default?queue_name=failed'
65 |
66 | routing:
67 | App\Message\Interfaces\MessageHighInterface: async_priority_high
68 | App\Message\Interfaces\MessageLowInterface: async_priority_low
69 |
70 | # Route your messages to the transports
71 | # 'App\Message\YourMessage': async
72 |
73 | when@test:
74 | framework:
75 | messenger:
76 | transports:
77 | async_priority_high: 'in-memory://'
78 | async_priority_low: 'in-memory://'
79 |
--------------------------------------------------------------------------------
/config/packages/monolog.yaml:
--------------------------------------------------------------------------------
1 | monolog:
2 | channels:
3 | - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
4 |
5 | when@dev:
6 | monolog:
7 | handlers:
8 | main:
9 | type: stream
10 | path: '%kernel.logs_dir%/%kernel.environment%.log'
11 | level: debug
12 | channels: [ '!event' ]
13 | buffered:
14 | type: buffer
15 | handler: easylog
16 | level: debug
17 | channels: [ '!event' ]
18 | easylog:
19 | type: service
20 | id: easy_log.handler
21 | # Disabled for now see - https://github.com/symfony/symfony/pull/46475
22 | #firephp:
23 | # type: firephp
24 | # level: info
25 | chromephp:
26 | type: chromephp
27 | level: info
28 | console:
29 | type: console
30 | process_psr_3_messages: false
31 | channels: [ '!event', '!doctrine', '!console' ]
32 |
33 | when@prod: &prod
34 | monolog:
35 | handlers:
36 | main:
37 | type: fingers_crossed
38 | action_level: error
39 | handler: nested
40 | excluded_http_codes: [ 404, 405 ]
41 | buffer_size: 50 # How many messages should be saved? Prevent memory leaks
42 | nested:
43 | type: stream
44 | path: php://stderr
45 | level: debug
46 | formatter: monolog.formatter.json
47 | console:
48 | type: console
49 | process_psr_3_messages: false
50 | channels: [ '!event', '!doctrine' ]
51 | deprecation:
52 | type: stream
53 | channels: [ deprecation ]
54 | path: php://stderr
55 | formatter: monolog.formatter.json
56 |
57 | when@staging: *prod
58 |
59 | when@test:
60 | monolog:
61 | handlers:
62 | main:
63 | type: fingers_crossed
64 | action_level: error
65 | handler: nested
66 | excluded_http_codes: [ 404, 405 ]
67 | channels: [ '!event' ]
68 | buffer_size: 50 # How many messages should be saved? Prevent memory leaks
69 | nested:
70 | type: stream
71 | path: '%kernel.logs_dir%/%kernel.environment%.log'
72 | level: debug
73 | buffered:
74 | type: buffer
75 | handler: easylog
76 | level: error
77 | channels: [ '!event' ]
78 | easylog:
79 | type: service
80 | id: easy_log.handler
81 |
--------------------------------------------------------------------------------
/config/packages/notifier.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | notifier:
3 | #chatter_transports:
4 | # slack: '%env(SLACK_DSN)%'
5 | # telegram: '%env(TELEGRAM_DSN)%'
6 | #texter_transports:
7 | # twilio: '%env(TWILIO_DSN)%'
8 | # nexmo: '%env(NEXMO_DSN)%'
9 | channel_policy:
10 | # use chat/slack, chat/telegram, sms/twilio or sms/nexmo
11 | urgent: ['email']
12 | high: ['email']
13 | medium: ['email']
14 | low: ['email']
15 | admin_recipients:
16 | - { email: admin@example.com }
17 |
--------------------------------------------------------------------------------
/config/packages/routing.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | router:
3 | utf8: true
4 |
5 | # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
6 | # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
7 | #default_uri: http://localhost
8 |
9 | when@prod: &prod
10 | framework:
11 | router:
12 | strict_requirements: null
13 |
14 | when@staging: *prod
15 |
--------------------------------------------------------------------------------
/config/packages/scheduler.yaml:
--------------------------------------------------------------------------------
1 | # See full configuration at
2 | # https://github.com/Dukecity/CommandSchedulerBundle/wiki/Configuration
3 | dukecity_command_scheduler:
4 |
5 | # Scheduler will write output files here. set false to disable it.
6 | log_path: "%kernel.logs_dir%"
7 |
8 | # Add namespace you don't want to see its Command in the scheduler.
9 | excluded_command_namespaces:
10 | - _global
11 | - scheduler
12 | - server
13 | - container
14 | - config
15 | - generate
16 | - init
17 | - router
18 | - doctrine
19 | - debug
20 |
--------------------------------------------------------------------------------
/config/packages/security.yaml:
--------------------------------------------------------------------------------
1 | security:
2 | # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
3 | password_hashers:
4 | Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
5 |
6 | # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
7 | providers:
8 | users_in_memory: { memory: null }
9 |
10 | # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
11 | firewalls:
12 | dev:
13 | pattern: ^/(_(profiler|wdt)|css|images|js)/
14 | security: false
15 | main:
16 | lazy: true
17 | provider: users_in_memory
18 |
19 | # activate different ways to authenticate
20 | # https://symfony.com/doc/current/security.html#the-firewall
21 |
22 | # https://symfony.com/doc/current/security/impersonating_user.html
23 | # switch_user: true
24 |
25 | # Easy way to control access for large sections of your site
26 | # Note: Only the *first* access control that matches will be used
27 | access_control:
28 | # - { path: ^/admin, roles: ROLE_ADMIN }
29 | # - { path: ^/profile, roles: ROLE_USER }
30 | - { path: ^/command-scheduler, roles: ROLE_ADMIN }
31 |
32 | when@test:
33 | security:
34 | password_hashers:
35 | # By default, password hashers are resource intensive and take time. This is
36 | # important to generate secure password hashes. In tests however, secure hashes
37 | # are not important, waste resources and increase test times. The following
38 | # reduces the work factor to the lowest possible values.
39 | Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
40 | algorithm: auto
41 | cost: 4 # Lowest possible value for bcrypt
42 | time_cost: 3 # Lowest possible value for argon
43 | memory_cost: 10 # Lowest possible value for argon
44 |
--------------------------------------------------------------------------------
/config/packages/test/systemsdk_easy_log.yaml:
--------------------------------------------------------------------------------
1 | easy_log:
2 | log_path: '%kernel.logs_dir%/%kernel.environment%-readable.log'
3 | max_line_length: 120
4 | prefix_length: 2
5 | ignored_routes: ['_wdt', '_profiler']
6 |
--------------------------------------------------------------------------------
/config/packages/translation.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | default_locale: '%locale%'
3 | translator:
4 | default_path: '%kernel.project_dir%/translations'
5 | fallbacks:
6 | - '%locale%'
7 | # providers:
8 | # crowdin:
9 | # dsn: '%env(CROWDIN_DSN)%'
10 | # loco:
11 | # dsn: '%env(LOCO_DSN)%'
12 | # lokalise:
13 | # dsn: '%env(LOKALISE_DSN)%'
14 | # phrase:
15 | # dsn: '%env(PHRASE_DSN)%'
16 |
--------------------------------------------------------------------------------
/config/packages/twig.yaml:
--------------------------------------------------------------------------------
1 | twig:
2 | default_path: '%kernel.project_dir%/templates'
3 | file_name_pattern: '*.twig'
4 |
5 | when@test:
6 | twig:
7 | strict_variables: true
8 |
--------------------------------------------------------------------------------
/config/packages/validator.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | validation:
3 | email_validation_mode: html5
4 |
5 | # Enables validator auto-mapping support.
6 | # For instance, basic validation constraints will be inferred from Doctrine's metadata.
7 | #auto_mapping:
8 | # App\Entity\: []
9 |
10 | when@test:
11 | framework:
12 | validation:
13 | not_compromised_password: false
14 |
--------------------------------------------------------------------------------
/config/packages/web_profiler.yaml:
--------------------------------------------------------------------------------
1 | when@dev:
2 | web_profiler:
3 | toolbar: true
4 | intercept_redirects: false
5 |
6 | framework:
7 | profiler:
8 | only_exceptions: false
9 | collect_serializer_data: true
10 |
11 | when@test:
12 | web_profiler:
13 | toolbar: false
14 | intercept_redirects: false
15 |
16 | framework:
17 | profiler: { collect: false }
18 |
--------------------------------------------------------------------------------
/config/preload.php:
--------------------------------------------------------------------------------
1 |
4 | #
5 | # For the full copyright and license information, please view
6 | # https://symfony.com/doc/current/contributing/code/license.html
7 |
8 | function _sf_console
9 | set sf_cmd (commandline -o)
10 | set c (count (commandline -oc))
11 |
12 | set completecmd "$sf_cmd[1]" "_complete" "--no-interaction" "-sfish" "-a1"
13 |
14 | for i in $sf_cmd
15 | if [ $i != "" ]
16 | set completecmd $completecmd "-i$i"
17 | end
18 | end
19 |
20 | set completecmd $completecmd "-c$c"
21 |
22 | $completecmd
23 | end
24 |
25 | complete -c 'console' -a '(_sf_console)' -f
26 |
--------------------------------------------------------------------------------
/docker/fish/config.fish:
--------------------------------------------------------------------------------
1 | source /home/www-data/.config/fish/completions/sf_console.fish
2 |
3 | if status is-interactive
4 | # Commands to run in interactive sessions can go here
5 | end
6 |
--------------------------------------------------------------------------------
/docker/fish/functions/console.fish:
--------------------------------------------------------------------------------
1 | # Defined in - @ line 1
2 | function console --wraps=/var/www/html/bin/console --description 'alias console=/var/www/html/bin/console'
3 | /var/www/html/bin/console $argv;
4 | end
5 |
--------------------------------------------------------------------------------
/docker/general/cron:
--------------------------------------------------------------------------------
1 | # Cron use www-data with sudo, because we need to redirect logs into /dev/stdout /dev/stderr for container
2 | * * * * * sudo -u www-data /usr/local/bin/php /var/www/html/bin/console scheduler:execute > /proc/1/fd/1 2>/proc/1/fd/2
3 |
--------------------------------------------------------------------------------
/docker/general/do_we_need_xdebug.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | if [ "$ENV" == "dev" ] || [ "$ENV" == "test" ]; then
4 | pecl install xdebug-$XDEBUG_VERSION
5 | mv /tmp/xdebug.ini /usr/local/etc/php/conf.d/
6 | else
7 | rm /tmp/xdebug.ini
8 | fi
9 |
--------------------------------------------------------------------------------
/docker/general/supervisord.conf:
--------------------------------------------------------------------------------
1 | [supervisord]
2 | nodaemon=true
3 |
4 | [program:cron]
5 | command=/usr/sbin/cron -l 2 -f
6 | autostart=true
7 | autorestart=true
8 |
9 | [program:messenger-consume]
10 | directory=/var/www/html/
11 | command=/usr/local/bin/php bin/console messenger:consume async_priority_high async_priority_low --time-limit=3600
12 | user=www-data
13 | #numprocs=2
14 | autostart=true
15 | autorestart=true
16 | startretries=40
17 | process_name=%(program_name)s_%(process_num)02d
18 | stdout_logfile_maxbytes=0
19 | stdout_logfile=/proc/1/fd/1
20 | stderr_logfile_maxbytes=0
21 | stderr_logfile=/proc/1/fd/2
22 |
--------------------------------------------------------------------------------
/docker/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:alpine
2 |
3 | # set main params
4 | ARG BUILD_ARGUMENT_ENV=dev
5 | ENV ENV=$BUILD_ARGUMENT_ENV
6 |
7 | RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
8 | ln -sf /dev/stderr /var/log/nginx/error.log && \
9 | rm -rf /etc/nginx/conf.d/*
10 |
11 | # install openssl
12 | RUN apk add --update openssl && \
13 | rm -rf /var/cache/apk/*
14 |
15 | # create folder for certificates
16 | RUN mkdir -p /etc/nginx/certificates
17 |
18 | # generate certificates
19 | # TODO: change it and make additional logic for production environment
20 | RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certificates/key.pem -out /etc/nginx/certificates/cert.pem -subj "/C=AT/ST=Vienna/L=Vienna/O=Security/OU=Development/CN=example.com"
21 |
22 | # put nginx config
23 | COPY ./$BUILD_ARGUMENT_ENV/nginx.conf /etc/nginx/conf.d/default.conf
24 |
--------------------------------------------------------------------------------
/docker/prod/nginx.conf:
--------------------------------------------------------------------------------
1 | map $http_x_forwarded_proto $fe_https {
2 | default off;
3 | https on;
4 | }
5 |
6 | server {
7 | listen 80;
8 |
9 | listen 443 ssl;
10 | ssl_certificate /etc/nginx/certificates/cert.pem;
11 | ssl_certificate_key /etc/nginx/certificates/key.pem;
12 |
13 | server_tokens off;
14 | client_max_body_size 50M;
15 | gzip on;
16 | gzip_comp_level 6;
17 | gzip_http_version 1.0;
18 | gzip_proxied any;
19 | gzip_disable "msie6";
20 | gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
21 |
22 | set $root /var/www/html/public;
23 |
24 | root $root;
25 |
26 | index index.php index.html;
27 |
28 | # Logs
29 | access_log /var/log/nginx/access.log;
30 | error_log /var/log/nginx/error.log;
31 |
32 | # Block all web requests to hidden directories
33 | location ~ /\. {
34 | deny all;
35 | }
36 |
37 | # Block access to build scripts.
38 | location ~* /(Gruntfile\.js|package\.json|node_modules) {
39 | deny all;
40 | return 404;
41 | }
42 |
43 | # Add cache headers for site assets.
44 | location ~* \.(?:ico|css|js|gif|jpe?g|png|eot|woff|ttf)$ {
45 | expires 30d;
46 | add_header Pragma public;
47 | add_header Cache-Control "public";
48 | }
49 |
50 | location / {
51 | try_files $uri $uri/ /index.php?$args;
52 | }
53 |
54 | location ~ \.php$ {
55 | proxy_set_header X-Real-IP $remote_addr;
56 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
57 | try_files $uri =404;
58 | fastcgi_split_path_info ^(.+\.php)(/.+)$;
59 | fastcgi_pass symfony:9000;
60 | fastcgi_index index.php;
61 | include fastcgi_params;
62 | fastcgi_buffer_size 32k;
63 | fastcgi_buffers 4 32k;
64 | fastcgi_param HTTPS $fe_https;
65 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
66 | fastcgi_param PATH_INFO $fastcgi_path_info;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/docker/prod/www.conf:
--------------------------------------------------------------------------------
1 | [www]
2 | user = www-data
3 | group = www-data
4 | listen = *:9000
5 | pm = ondemand
6 | pm.max_children = 150
7 | pm.start_servers = 10
8 | pm.min_spare_servers = 10
9 | pm.max_spare_servers = 20
10 | pm.process_idle_timeout = 60s
11 | pm.max_requests = 10
12 | request_terminate_timeout = 60s
13 | request_slowlog_timeout = 30s
14 | slowlog = /proc/self/fd/2
--------------------------------------------------------------------------------
/docker/rabbitmq/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM rabbitmq:4.0-management-alpine
2 |
3 | COPY rabbitmq_delayed_message_exchange-v4.0.7.ez /opt/rabbitmq/plugins/
4 | RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange
5 |
--------------------------------------------------------------------------------
/docker/rabbitmq/rabbitmq_delayed_message_exchange-v4.0.7.ez:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docker/rabbitmq/rabbitmq_delayed_message_exchange-v4.0.7.ez
--------------------------------------------------------------------------------
/docker/staging/nginx.conf:
--------------------------------------------------------------------------------
1 | map $http_x_forwarded_proto $fe_https {
2 | default off;
3 | https on;
4 | }
5 |
6 | server {
7 | listen 80;
8 |
9 | listen 443 ssl;
10 | ssl_certificate /etc/nginx/certificates/cert.pem;
11 | ssl_certificate_key /etc/nginx/certificates/key.pem;
12 |
13 | server_tokens off;
14 | client_max_body_size 50M;
15 | gzip on;
16 | gzip_comp_level 6;
17 | gzip_http_version 1.0;
18 | gzip_proxied any;
19 | gzip_disable "msie6";
20 | gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
21 |
22 | set $root /var/www/html/public;
23 |
24 | root $root;
25 |
26 | index index.php index.html;
27 |
28 | # Logs
29 | access_log /var/log/nginx/access.log;
30 | error_log /var/log/nginx/error.log;
31 |
32 | # Block all web requests to hidden directories
33 | location ~ /\. {
34 | deny all;
35 | }
36 |
37 | # Block access to build scripts.
38 | location ~* /(Gruntfile\.js|package\.json|node_modules) {
39 | deny all;
40 | return 404;
41 | }
42 |
43 | # Add cache headers for site assets.
44 | location ~* \.(?:ico|css|js|gif|jpe?g|png|eot|woff|ttf)$ {
45 | expires 30d;
46 | add_header Pragma public;
47 | add_header Cache-Control "public";
48 | }
49 |
50 | location / {
51 | try_files $uri $uri/ /index.php?$args;
52 | }
53 |
54 | location ~ \.php$ {
55 | proxy_set_header X-Real-IP $remote_addr;
56 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
57 | try_files $uri =404;
58 | fastcgi_split_path_info ^(.+\.php)(/.+)$;
59 | fastcgi_pass symfony:9000;
60 | fastcgi_index index.php;
61 | include fastcgi_params;
62 | fastcgi_buffer_size 32k;
63 | fastcgi_buffers 4 32k;
64 | fastcgi_param HTTPS $fe_https;
65 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
66 | fastcgi_param PATH_INFO $fastcgi_path_info;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/docker/staging/www.conf:
--------------------------------------------------------------------------------
1 | [www]
2 | user = www-data
3 | group = www-data
4 | listen = *:9000
5 | pm = ondemand
6 | pm.max_children = 150
7 | pm.start_servers = 10
8 | pm.min_spare_servers = 10
9 | pm.max_spare_servers = 20
10 | pm.process_idle_timeout = 60s
11 | pm.max_requests = 10
12 | request_terminate_timeout = 60s
13 | request_slowlog_timeout = 30s
14 | slowlog = /proc/self/fd/2
--------------------------------------------------------------------------------
/docker/test/nginx.conf:
--------------------------------------------------------------------------------
1 | map $http_x_forwarded_proto $fe_https {
2 | default off;
3 | https on;
4 | }
5 |
6 | server {
7 | listen 80;
8 |
9 | listen 443 ssl;
10 | ssl_certificate /etc/nginx/certificates/cert.pem;
11 | ssl_certificate_key /etc/nginx/certificates/key.pem;
12 |
13 | server_tokens off;
14 | client_max_body_size 50M;
15 | gzip on;
16 | gzip_comp_level 6;
17 | gzip_http_version 1.0;
18 | gzip_proxied any;
19 | gzip_disable "msie6";
20 | gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
21 |
22 | set $root /var/www/html/public;
23 |
24 | root $root;
25 |
26 | index index.php index.html;
27 |
28 | # Logs
29 | access_log /var/log/nginx/access.log;
30 | error_log /var/log/nginx/error.log;
31 |
32 | # Block all web requests to hidden directories
33 | location ~ /\. {
34 | deny all;
35 | }
36 |
37 | # Block access to build scripts.
38 | location ~* /(Gruntfile\.js|package\.json|node_modules) {
39 | deny all;
40 | return 404;
41 | }
42 |
43 | # Add cache headers for site assets.
44 | location ~* \.(?:ico|css|js|gif|jpe?g|png|eot|woff|ttf)$ {
45 | expires 30d;
46 | add_header Pragma public;
47 | add_header Cache-Control "public";
48 | }
49 |
50 | location / {
51 | try_files $uri $uri/ /index.php?$args;
52 | }
53 |
54 | location ~ \.php$ {
55 | proxy_set_header X-Real-IP $remote_addr;
56 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
57 | try_files $uri =404;
58 | fastcgi_split_path_info ^(.+\.php)(/.+)$;
59 | fastcgi_pass symfony:9000;
60 | fastcgi_index index.php;
61 | include fastcgi_params;
62 | fastcgi_buffer_size 32k;
63 | fastcgi_buffers 4 32k;
64 | fastcgi_param HTTPS $fe_https;
65 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
66 | fastcgi_param PATH_INFO $fastcgi_path_info;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/docker/test/www.conf:
--------------------------------------------------------------------------------
1 | [www]
2 | user = www-data
3 | group = www-data
4 | listen = *:9000
5 | pm = ondemand
6 | pm.max_children = 150
7 | pm.start_servers = 10
8 | pm.min_spare_servers = 10
9 | pm.max_spare_servers = 20
10 | pm.process_idle_timeout = 60s
11 | pm.max_requests = 10
12 | request_terminate_timeout = 60s
13 | request_slowlog_timeout = 30s
14 | slowlog = /proc/self/fd/2
--------------------------------------------------------------------------------
/docs/commands.md:
--------------------------------------------------------------------------------
1 | # Commands
2 | This document describing commands that can be used in local shell or inside symfony container shell.
3 |
4 | ## Local shell (Makefile)
5 | This environment comes with "Makefile" and it allows to simplify using some functionality.
6 | In order to use command listed bellow just use next syntax in your local shell: `make {command name}`.
7 | Next commands available for this environment:
8 | ```bash
9 | make help # Shows available commands with description
10 |
11 | make build # Build dev environment
12 | make build-test # Build test or continuous integration environment
13 | make build-staging # Build staging environment
14 | make build-prod # Build prod environment
15 |
16 | make start # Start dev environment
17 | make start-test # Start test or continuous integration environment
18 | make start-staging # Start staging environment
19 | make start-prod # Start prod environment
20 |
21 | make stop # Stop dev environment containers
22 | make stop-test # Stop test or continuous integration environment containers
23 | make stop-staging # Stop staging environment containers
24 | make stop-prod # Stop prod environment containers
25 |
26 | make down # Stop and remove dev environment containers, networks
27 | make down-test # Stop and remove test or continuous integration environment containers, networks
28 | make down-staging # Stop and remove staging environment containers, networks
29 | make down-prod # Stop and remove prod environment containers, networks
30 |
31 | make restart # Stop and start dev environment
32 | make restart-test # Stop and start test or continuous integration environment
33 | make restart-staging # Stop and start staging environment
34 | make restart-prod # Stop and start prod environment
35 |
36 | make env-staging # Creates cached config file .env.local.php (usually for staging environment)
37 | make env-prod # Creates cached config file .env.local.php (usually for prod environment)
38 |
39 | make ssh # Get bash inside symfony docker container
40 | make ssh-root # Get bash as root user inside symfony docker container
41 | make fish # Get fish shell inside symfony docker container (https://www.youtube.com/watch?v=C2a7jJTh3kU)
42 | make ssh-nginx # Get bash inside nginx docker container
43 | make ssh-supervisord # Get bash inside supervisord docker container (cron jobs running there, etc...)
44 | make ssh-mysql # Get bash inside mysql docker container
45 | make ssh-rabbitmq # Get bash inside rabbitmq docker container
46 |
47 | make exec # Exucutes some command, under the www-data user, defined in cmd="..." variable inside symfony container shell
48 | make exec-bash # Executes several commands, under the www-data user, defined in cmd="..." variable inside symfony container shell
49 | make exec-by-root # Executes some command, under the root user, defined in cmd="..." variable inside symfony container shell
50 |
51 | make report-prepare # Creates /reports/coverage folder, will be used for report after running tests
52 | make report-clean # Removes all reports in /reports/ folder
53 |
54 | make wait-for-db # Checks MySQL database availability, using for CI (f.e. /.circleci folder)
55 |
56 | make composer-install-no-dev # Installs composer no-dev dependencies
57 | make composer-install # Installs composer dependencies
58 | make composer-update # Updates composer dependencies
59 | make composer-audit # Checks for security vulnerability advisories for installed packages
60 |
61 | make info # Shows Php and Symfony version
62 |
63 | make logs # Shows logs for symfony container. Use ctrl+c in order to exit
64 | make logs-nginx # Shows logs for nginx container. Use ctrl+c in order to exit
65 | make logs-supervisord # Shows logs for supervisord container. Use ctrl+c in order to exit
66 | make logs-mysql # Shows logs for mysql container. Use ctrl+c in order to exit
67 | make logs-rabbitmq # Shows logs for rabbitmq container. Use ctrl+c in order to exit
68 |
69 | make drop-migrate # Drops databases and runs all migrations for the main/test databases
70 | make migrate # Runs all migrations for the main/test databases
71 | make migrate-no-test # Runs all migrations for the main database
72 |
73 | make fixtures # Runs all fixtures for test database without --append option (tables will be dropped and recreated)
74 |
75 | make messenger-setup-transports # Initializes transports for Symfony Messenger bundle
76 |
77 | make phpunit # Runs PhpUnit tests
78 | make report-code-coverage # Updates code coverage report on https://coveralls.io (COVERALLS_REPO_TOKEN should be set on CI side)
79 |
80 | make ecs # Runs Easy Coding Standard tool
81 | make ecs-fix # Runs Easy Coding Standard tool to fix issues
82 | make phpcs # Runs PHP CodeSniffer
83 | make phpmetrics # Generates PhpMetrics static analysis report
84 | make phpcpd # Runs php copy/paste detector
85 | make phpcpd-html-report # Generates phpcpd html report
86 | make phpmd # Runs php mess detector
87 | make phpstan # Runs PhpStan static analysis tool
88 | make phpinsights # Runs Php Insights analysis tool
89 |
90 | make composer-normalize # Normalizes composer.json file content
91 | make composer-validate # Validates composer.json file content
92 | make composer-require-checker # Checks the defined dependencies against your code
93 | make composer-unused # Shows unused packages by scanning and comparing package namespaces against your code
94 | ```
95 |
96 | ## Symfony container shell
97 | Inside symfony container shell available "native" symfony commands with their description and, in additional, custom commands.
98 | In order to enter inside symfony container shell please use next command on your local shell:
99 | ```bash
100 | make ssh
101 | ```
102 | After above command you will be inside symfony container and for display list of available commands please use next command:
103 | ```bash
104 | ./bin/console
105 | ```
106 | #### Custom commands in symfony container shell
107 | ```bash
108 | ./bin/console db:wait # Waits for database availability (1 mins max)
109 | ./bin/console messenger:setup-transports # Initializes transports for Symfony Messenger bundle
110 | ```
111 |
--------------------------------------------------------------------------------
/docs/development.md:
--------------------------------------------------------------------------------
1 | # Development
2 | This document contains basic information and recommendation for development.
3 |
4 | ## General
5 | * Follow the [PSR-1 guide](https://www.php-fig.org/psr/psr-1/), [PSR-12 guide](https://www.php-fig.org/psr/psr-12/), [Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html).
6 | * Try to keep class names informative but not too long.
7 | * Follow Symfony conventions and [best practices](https://symfony.com/doc/current/best_practices/index.html).
8 | * Separate application logic from presentation and data-persistence layers.
9 | * Use namespaces to group all related classes into separate folders.
10 | * Put stuff in the cache when its easy enough to invalidate.
11 | * Use [messenger](https://symfony.com/doc/current/components/messenger.html) to delegate when you don't need to wait for data to return.
12 | * Write documentation for all things outside of standard MVC functions.
13 | * Write application, integration and unit tests for all new features (in that order of priority).
14 | * All functionality needs to be "mockable", so that you can test every part of the app without 3rd party dependencies.
15 | * Use strict_types, type hinting and return type hinting.
16 | * Use PHPStorm IDE as currently it is most powerful IDE for PHP development on today's market.
17 |
18 | Within this application the base workflow is following:
19 |
20 | `Controller/Command <--> Resource <--> Repository <--> Entity`
21 |
22 | #### Exceptions
23 | * All Exceptions that should terminate the current request (and return an error message to the user) should be handled
24 | using Symfony [best practice](https://symfony.com/doc/current/controller/error_pages.html#use-kernel-exception-event).
25 | * All Exceptions that should be handled in the controller, or just logged for debugging, should be wrapped in a
26 | try catch block (catchable Exceptions).
27 | * Use custom Exceptions for all catchable scenarios, and try to use standard Exceptions for fatal Exceptions.
28 | * Use custom Exceptions to log.
29 |
30 | #### Entities
31 | Entities should only be data-persistence layers, i.e. defines relationships, attributes, helper methods
32 | but does not fetch collections of data.
33 |
34 | #### Repositories
35 | Repositories need to be responsible for parameter handling and query builder callbacks/joins.
36 | Parameter handling can help with generic REST queries.
37 |
38 | #### Resources
39 | Resource services are layer between your controller/command and repository.
40 | Within this layer it is possible to control how to `mutate` repository data for application needs.
41 | Resource services are basically the application foundation and it can control your request and response as you like.
42 |
43 | #### Controllers
44 | Keep controllers clean of application logic. They should ideally just inject resources/services - either through
45 | the constructor (if used more than once) or in the controller method itself.
46 |
47 | #### Events
48 | Events are handled by event listeners. Please follow instruction [here](https://symfony.com/doc/current/event_dispatcher.html).
49 |
50 | #### Serializers
51 | Use [Serializer component](https://symfony.com/doc/current/components/serializer.html) to transform data into JSON.
52 |
53 | #### Services
54 | Isolate 3rd party dependencies into Service classes for simple refactoring/extension.
55 |
56 |
57 | ## PHP code quality
58 | You can control code quality of your PHP project using already integrated code quality tools. Before creating merge request you can run on your local PC code quality tools and get the report with issues that you can fix.
59 | Also code quality tools integrated inside CI environment and after creating merge request you can check if you have some issues inside your code. Please find the list of code quality tools that we recommend to use while PHP backend development.
60 |
61 | ### PHP coding standard
62 | This tool is an essential development tool that ensures your code remains coding standard.
63 |
64 | PHP coding standard is available for dev/test environment using next local shell command:
65 | ```bash
66 | make ecs
67 | ```
68 |
69 | If you want to fix all possible issues in auto mode(some issues can be fixed only manually) just use next local shell command:
70 | ```bash
71 | make ecs-fix
72 | ```
73 |
74 | ### PHP code sniffer
75 | This tool is an essential development tool that ensures your code remains clean and consistent.
76 |
77 | PHP Code Sniffer is available for dev/test environment using next local shell command:
78 | ```bash
79 | make phpcs
80 | ```
81 |
82 | If you are using [PhpStorm](https://www.jetbrains.com/phpstorm/) you can configure PHP Code Sniffer using recommendation
83 | [here](https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html).
84 |
85 | ### PHPStan static analysis tool
86 | PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code.
87 | It moves PHP closer to compiled languages in the sense that the correctness of each line of the code can be checked before you run the actual line.
88 |
89 | PHPStan static analysis tool is available for dev/test environment using next local shell command:
90 | ```bash
91 | make phpstan
92 | ```
93 |
94 | ### Phpinsights PHP quality checks
95 | PHP Insights was carefully crafted to simplify the analysis of your code directly from your terminal, and is the perfect starting point to analyze the code quality of your PHP projects.
96 |
97 | Phpinsights is available for dev/test environment using next local shell command:
98 | ```bash
99 | make phpinsights
100 | ```
101 |
102 | ### PHP mess detector
103 | This tool takes a given PHP source code base and look for several potential problems within that source. These problems can be things like:
104 | * Possible bugs
105 | * Suboptimal code
106 | * Overcomplicated expressions
107 | * Unused parameters, methods, properties
108 |
109 | PHP mess detector is available for dev/test environment using next local shell command:
110 | ```bash
111 | make phpmd
112 | ```
113 |
114 | ### PHP copy/paste detector
115 | This tool is a copy/paste detector for PHP code.
116 |
117 | PHP copy/paste detector is available for dev/test environment using next local shell commands:
118 | ```bash
119 | make phpcpd
120 | make phpcpd-html-report
121 | ```
122 |
123 | ### Composer tools
124 | To normalize or validate your composer.json you can use next local shell commands:
125 | ```bash
126 | make composer-normalize
127 | make composer-validate
128 | ```
129 |
130 | If you need to find unused packages by scanning your code you can use next local shell commands:
131 | ```bash
132 | make composer-unused
133 | ```
134 |
135 | In order to check the defined dependencies against your code you can use next local shell commands:
136 | ```bash
137 | make composer-require-checker
138 | ```
139 |
140 | ### Metrics
141 | This environment contains [PhpMetrics](https://github.com/phpmetrics/phpmetrics) to make some code analysis.
142 | Use next local shell command in order to run it:
143 | ```bash
144 | make phpmetrics
145 | ```
146 | Note: You need run tests before this local shell command.
147 |
148 | After execution above local shell command please open `reports/phpmetrics/index.html` with your browser.
149 |
150 | ### Rector
151 | Rector instantly upgrades and refactors the PHP code of your application. It can help you in 2 major areas:
152 | - Instant upgrades
153 | - Automated refactoring
154 |
155 | Rector now supports upgrades of your code from PHP 5.3 to 8.3 or upgrades your code for new framework version. This tool supports major open-source projects like Symfony, PHPUnit, Nette, Laravel, CakePHP and Doctrine.
156 | You can find live demo [here](https://symfonycasts.com/screencast/symfony6-upgrade/rector) or more info [here](https://packagist.org/packages/rector/rector).
157 |
158 | Rector is available for test/dev environment. If you need to run this tool, please use next local shell command in order to enter inside symfony container shell and then run rector:
159 | ```bash
160 | make ssh
161 | ```
162 | ```bash
163 | vendor/bin/rector process src/your_folder_with_code_for_refactoring
164 | ```
165 | Note: You can process rector without specifying folder, in such case it will process src and tests folder.
166 |
167 | ### Qodana (trial)
168 | Qodana is a smart code quality platform by JetBrains. This powerful static analysis engine enables development teams to automate code reviews, build quality gates, and enforce code quality guidelines enterprise-wide – all within their JetBrains ecosystems.
169 | The platform can be integrated into any CI/CD pipeline and can analyze code (currently there are some issues with CI - https://youtrack.jetbrains.com/issue/QD-7379).
170 |
171 | If you are using IDE PHPStorm, you can use it via menu `Tools` -> `Qodana` -> `Try Code Analysis with Qodana` -> `Try Locally` -> `Run`.
172 | You can find some video [here](https://blog.jetbrains.com/qodana/2023/09/code-quality-under-pressure-supporting-developers-with-qodana-integration-in-intellij-based-ides/) or more info [here](https://www.jetbrains.com/help/qodana/getting-started.html).
173 |
174 | ## Database changes
175 | Doctrine migrations it is functionality for versioning your database schema and easily deploying changes to it.
176 | Migration files contain all necessary database changes to get application running with its database structure.
177 | In order to migrate changes to your database please use next command in symfony container shell:
178 | ```bash
179 | ./bin/console doctrine:migrations:migrate
180 | ```
181 | Note: Also you can use make command (`make migrate`) in your local shell and it will make necessary changes to main database and test database.
182 |
183 | Please use next workflow for migrations:
184 |
185 | 1. Make changes (create/edit/delete) to entities in `/src/Entity/` folder
186 | 2. Run `diff` command to create new migration file
187 | 3. Run `migrate` command to make actual changes to your database
188 | 4. Run `validate` command to validate your mappings and actual database structure
189 |
190 | Above commands you can run in symfony container shell using next: `./bin/console doctrine:migrations:`.
191 |
192 | Using above workflow allow you make database changes on your application.
193 | Also you do not need to make any migrations files by hand (Doctrine will handle it).
194 | Please always check generated migration files to make sure that those doesn't contain anything that you really don't want.
195 |
196 | ## IDE
197 | Short list of most popular IDE for PHP development:
198 |
199 | * [PhpStorm](https://www.jetbrains.com/phpstorm/)
200 | * [Zend Studio](https://www.zend.com/products/zend-studio)
201 | * [Eclipse PDT](https://www.eclipse.org/pdt/)
202 | * [NetBeans](https://netbeans.org/)
203 | * [Sublime Text](https://www.sublimetext.com/)
204 |
--------------------------------------------------------------------------------
/docs/images/phpstorm_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_00.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_01.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_02.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_03.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_04.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_05.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_06.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_12.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_13.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_code_style.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_code_style.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_inspections.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_inspections.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_php_code_sniffer_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_php_code_sniffer_1.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_php_code_sniffer_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_php_code_sniffer_2.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_php_cs_fixer_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_php_cs_fixer_1.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_php_cs_fixer_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_php_cs_fixer_2.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_phpmd_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_phpmd_1.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_phpmd_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_phpmd_2.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_phpstan_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_phpstan_1.png
--------------------------------------------------------------------------------
/docs/images/phpstorm_phpstan_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/phpstorm_phpstan_2.png
--------------------------------------------------------------------------------
/docs/images/postman_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/postman_01.png
--------------------------------------------------------------------------------
/docs/images/xdebug_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/xdebug_01.png
--------------------------------------------------------------------------------
/docs/images/xdebug_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/docs/images/xdebug_02.png
--------------------------------------------------------------------------------
/docs/messenger.md:
--------------------------------------------------------------------------------
1 | # Messenger
2 | This document describing how you can use [symfony/messenger](https://symfony.com/doc/current/messenger.html) bundle inside this environment.
3 |
4 | ## Using messenger
5 | ### Description
6 | Symfony's Messenger is much powerful bundle, that supports by the symfony core team, and provides a message bus and some routing capabilities to send messages within your application and through transports such as message queues. Before using it, read the [Messenger component](https://symfony.com/doc/current/components/messenger.html) documentation to get familiar with its concepts.
7 |
8 | ### RabbitMQ
9 | This environment is using [RabbitMQ](https://hub.docker.com/_/rabbitmq) message broker software. RabbitMQ is open source message broker software (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written in the Erlang programming language and is built on the Open Telecom Platform framework for clustering and failover. Client libraries to interface with the broker are available for all major programming languages.
10 |
11 | ### Admin panel
12 | You can use your browser in order to manage/view messages. Just open next url in your browser: [http://localhost:15672](http://localhost:15672). Default login - `guest` and password - `guest` (you are able to change it inside `.env` configuration file).
13 |
14 | ### Consuming Messages
15 | Once your messages have been routed, it will be consumed. In case any issue just make sure that program:messenger is working in supervisord. You can use make command `make logs-supervisord` for these needs.
16 |
17 | ### Message and Handler
18 | Before you can send a message, you must create it first. In order to do something when your message is dispatched, you need to create a message handler. Please follow docs in order to implement it:
19 |
20 | * [Message](https://symfony.com/doc/current/messenger.html#creating-a-message-handler)
21 | * [Handler](https://symfony.com/doc/current/messenger.html#creating-a-message-handler)
22 |
23 | ## RabbitMQ Management HTTP API
24 | When activated, the management plugin provides an HTTP API at http://server-name:15672/api/ by default. Browse to that location for more information on the API. For convenience the same API reference is available from GitHub:
25 | * [RabbitMQ Management HTTP API](https://rawcdn.githack.com/rabbitmq/rabbitmq-server/v3.11.5/deps/rabbitmq_management/priv/www/api/index.html)
26 |
--------------------------------------------------------------------------------
/docs/phpstorm.md:
--------------------------------------------------------------------------------
1 | # IDE JetBrains PhpStorm
2 | This document describing how you can configure your IDE [PhpStorm](https://www.jetbrains.com/phpstorm/).
3 |
4 | ## Configuring PhpStorm
5 | ### General
6 | * Go to `Settings -> Plugins` and install next plugins:
7 | - .env files support
8 | - .ignore
9 | - Makefile Language
10 | - Php Annotations
11 | - Php Inspections (EA Extended)
12 | - Php Toolbox
13 | - Symfony support (Has some paid functions, [homepage](https://espend.de/phpstorm/plugin/symfony))
14 | - Rainbow brackets
15 | - String Manipulation
16 | - Extra ToolWindow Colorful Icons
17 | * Go to `Settings -> Php -> Symfony` and check `Enable plugin for this project` and set Web Directory value as `public`.
18 | * If you want control quality of your PHP project - pay your attention to the tools, described [here](development.md).
19 |
20 | ### CLI Interpreter
21 | You need to set correct CLI interpreter for your PhpStorm.
22 | In order to do it please open `Settings -> PHP` section and follow recommendations [configuring remote PHP interpreters](https://www.jetbrains.com/help/phpstorm/configuring-remote-interpreters.html).
23 |
24 | 
25 | 
26 |
27 | ### Composer
28 | Go to `Settings -> Php -> Composer` and set path to composer.json, check other settings:
29 |
30 | 
31 |
32 | ### Server
33 | In order to configure PHP servers please open `Settings -> PHP -> Servers`.
34 | You need to configure how your local files will be mapped inside docker container:
35 |
36 | 
37 |
38 | ### Test Frameworks
39 | If you want to run tests directly from your IDE you need to do following configuration in `Settings -> PHP -> Test Frameworks`:
40 |
41 | 
42 |
43 | Next you need to add Run/Debug configuration for PHP Remote Debug. It needs to be the same as image below:
44 |
45 | 
46 |
47 | ### Debugging
48 | In order to use Xdebug as debugging tool please follow [Using Xdebug](xdebug.md) documentation.
49 |
50 | ### Code Style
51 | This environment has committed `.idea/` catalog, so most IDE configs should be available out of the box. But if you want to have own configs, you can put `./idea` in gitignore and delete folder from the git repository.
52 | Anyway you can always import our recommended code style if you don't have committed `./idea` folder inside your repository:
53 | * Go to `Settings -> Editor -> Code Style -> PHP` and import scheme `Project` (CodeStyle.xml) from [docs/phpstorm](phpstorm):
54 |
55 | 
56 |
57 | ### PHP Inspections and code quality tools
58 | * Go to `Settings -> PHP -> Quality tools` and configure next:
59 |
60 | 
61 | 
62 | 
63 | 
64 |
65 | Note: make sure that you have proper local path for the PHP CS Fixer ruleset `.php-cs-fixer.dist.php`.
66 |
67 | 
68 | 
69 | 
70 | 
71 |
72 | Note: make sure that you have proper local path for the MessDetector ruleset `phpmd_ruleset.xml`.
73 |
74 | 
75 |
76 | * If you don't have committed folder `.idea/`, go to `Settings -> Editor -> Inspections` and import profile `Project Default` (Inspections.xml) from [docs/phpstorm](phpstorm):
77 |
78 | 
79 |
80 | * Go to `Settings -> Tools -> External tools` and create ecs tool:
81 |
82 | 
83 |
84 | Note: Arguments value should be `exec-bash cmd="./vendor/bin/ecs --clear-cache check $FilePathRelativeToProjectRoot$"`.
85 |
86 | Note: In order to use it - right click on the necessary file/folder in PhpStorm and select context menu `External Tools -> ecs`.
87 |
88 | * Go to `Settings -> Tools -> External tools` and create phpcs tool:
89 |
90 | 
91 |
92 | Note: Arguments value should be `exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR12 --colors -p $FilePathRelativeToProjectRoot$"`.
93 |
94 | Note: In order to use it - right click on the necessary file/folder in PhpStorm and select context menu `External Tools -> phpcs`.
95 |
96 |
97 | For inspecting your code you can use main menu item `Code -> Inspect Code`. Code will be processed by code quality tools like PHP CS Fixer, PHP Mess Detector, PHP CodeSniffer, PHPStan.
98 |
99 | ## External documentations
100 | * [Configuring Remote PHP Interpreters](https://www.jetbrains.com/help/phpstorm/configuring-remote-interpreters.html)
101 | * [Test Frameworks](https://www.jetbrains.com/help/phpstorm/php-test-frameworks.html)
102 | * [Symfony Development using PhpStorm](http://blog.jetbrains.com/phpstorm/2014/08/symfony-development-using-phpstorm/)
103 | * [Symfony Plugin for PhpStorm](https://plugins.jetbrains.com/plugin/7219-symfony-plugin)
104 | * [PHP Annotations plugin for PhpStorm](https://plugins.jetbrains.com/plugin/7320)
105 | * [PHP Toolbox plugin for PhpStorm](https://plugins.jetbrains.com/plugin/8133-php-toolbox/)
106 | * [Php Inspections (EA Extended) plugin for PhpStorm](https://plugins.jetbrains.com/idea/plugin/7622-php-inspections-ea-extended-)
107 | * [Qodana code quality tool](https://blog.jetbrains.com/qodana/2023/09/code-quality-under-pressure-supporting-developers-with-qodana-integration-in-intellij-based-ides/)
108 |
--------------------------------------------------------------------------------
/docs/phpstorm/CodeStyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/docs/phpstorm/Inspections.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
--------------------------------------------------------------------------------
/docs/testing.md:
--------------------------------------------------------------------------------
1 | # Testing
2 | This document describing how you can run tests within this environment.
3 |
4 | ### General
5 | This environment contains next [types](https://symfony.com/doc/current/testing.html#types-of-tests) of tests:
6 |
7 | * Application tests (TODO: Implement it)
8 | * Integration tests (TODO: Implement it)
9 | * Unit tests (TODO: Implement it)
10 |
11 | All tests relies to [PHPUnit](https://phpunit.de/) library.
12 |
13 | Note 1: Please note that this environment does not use simple phpunit as does Symfony by default, that's why symfony container shell `./bin/phpunit` command is not exist.
14 |
15 | Note 2: `Application` test === `Functional` test, please use naming convention(`Application`) as described [here](https://symfony.com/doc/current/testing.html#application-tests).
16 |
17 | ### Commands to run tests
18 | You can run tests using following local shell command(s):
19 | ```bash
20 | make phpunit # Run all tests
21 | ```
22 |
23 | After execution above local shell command you are able to check code coverage report. Please open `reports/coverage/index.html` with your browser.
24 |
25 | If you want to run single test or all tests in specified directory you can use next steps:
26 |
27 | 1.Use next local shell command in order to enter into symfony container shell:
28 | ```bash
29 | make ssh # Enter symfony container shell
30 | ```
31 | 2.Use next symfony container shell command(s) in order to run test(s):
32 | ```bash
33 | ./vendor/bin/phpunit ./tests/Application/Controller/ApiKeyControllerTest.php # Just this single test class
34 | ./vendor/bin/phpunit ./tests/Application/Controller/ # All tests in this directory
35 | ```
36 |
37 | ### Separate environment for testing
38 | By default this environment is using separate database for testing.
39 | If you need to change separate environment for testing (f.e. change database or another stuff) you need to edit `.env.test` file.
40 |
41 |
42 | ## Metrics
43 | This environment contains [PhpMetrics](https://github.com/phpmetrics/phpmetrics) to make some code analysis.
44 | Use next local shell command in order to run it:
45 | ```bash
46 | make phpmetrics
47 | ```
48 | Note: You need run tests before this local shell command.
49 |
50 | After execution above local shell command please open `reports/phpmetrics/index.html` with your browser.
51 |
52 | ## PhpStorm
53 | You can run tests directly from your IDE PhpStorm. Please follow [PhpStorm](phpstorm.md) documentation in order to do it.
54 |
--------------------------------------------------------------------------------
/docs/xdebug.md:
--------------------------------------------------------------------------------
1 | # Xdebug
2 | This document describing how you can use [Xdebug](https://xdebug.org/) and [PhpStorm](https://www.jetbrains.com/phpstorm/) within DEV environment.
3 |
4 | ## Configuration and usage
5 | Please follow [PhpStorm](phpstorm.md) documentation before actions described bellow.
6 |
7 | ### PhpStorm basic configuration
8 | 1.Check /docker/dev/xdebug-main.ini or /docker/dev/xdebug-osx.ini (optional)
9 |
10 | - In case you need debug only requests with IDE KEY: PHPSTORM from frontend in your browser:
11 | ```bash
12 | xdebug.start_with_request = no
13 | ```
14 | Install locally in Firefox extension "Xdebug helper" and set in settings IDE KEY: PHPSTORM
15 |
16 | - In case you need debug any request to an api (by default):
17 | ```bash
18 | xdebug.start_with_request = yes
19 | ```
20 |
21 | 2.Go to `Settings -> Php -> Debug` and set Xdebug port `10000`
22 |
23 | 3.Check your `Run/Debug Configurations` as on image bellow
24 |
25 | 4.Install needed browser extensions (optional, see step 1). For example for Firefox install extension "Xdebug helper" and set in extension settings IDE KEY: PHPSTORM
26 |
27 | 
28 |
29 | 
30 |
31 | ### Using Xdebug
32 | After actions above you can start to listen incoming PHP debug connections:
33 |
34 | 1. Add breakpoint to your code
35 | 2. Enable Xdebug in your browser (optional, required only when xdebug.start_with_request = no)
36 | 3. Click `Debug` button in PhpStorm
37 | 4. Reload browser page
38 |
39 | If everything configured properly you will get something like next:
40 |
41 | 
42 |
43 | ## Debug Postman requests
44 | If you're using [Postman](https://www.getpostman.com/) to test/debug your application when `xdebug.start_with_request = no` you need to add `?XDEBUG_SESSION_START=PHPSTORM` to each URL
45 | that you use with Postman. If you have default configuration (`xdebug.start_with_request = yes`) - nothing to do and your Xdebug should work out of the box.
46 |
47 | ## Debug Console commands / Messenger async handlers
48 | If you want to debug console commands or messenger async handlers you just need to uncomment/edit (nothing to do in case MacOS and `XDEBUG_CONFIG=osx`) option `xdebug.client_host` in config `docker/dev/xdebug-main.ini`:
49 | ```bash
50 | xdebug.client_host=172.17.0.1
51 | ```
52 | Just find out the proper host ip in your docker bridge configuration and set above option (in general it is `172.17.0.1`).
53 | Don't forget to rebuild docker containers according to [general](../readme.md) documentation.
54 |
55 | If you want to debug your messenger async jobs just follow next steps:
56 |
57 | 1. Enter in `supervisord` docker container shell using your local shell command `make ssh-supervisord`
58 | 2. In `supervisord` container shell run next command `supervisorctl`
59 | 3. Stop program `messenger-consume:messenger-consume_00` using next command `stop messenger-consume:messenger-consume_00` and make sure that you can see message `messenger-consume:messenger-consume_00: stopped`
60 | 4. Exit from supervisorctl shell using next command `exit`
61 | 5. Exit from `supervisord` docker container using command `exit`. Make sure that you are in local shell.
62 | 6. Enter in `symfony` docker container shell using your local shell command `make ssh`
63 | 7. Put necessary message in queue or make sure that it is already there
64 | 8. Run PHPStorm debug
65 | 9. Run in `symfony` docker container shell next command in order to run your async handlers `/usr/local/bin/php bin/console messenger:consume async_priority_high async_priority_low --limit=1` (where limit option is a number of messages that you want to debug)
66 | 10. Have fun with debugging and don't forget to switch on program `messenger-consume:messenger-consume_00` (step 1, 2 and execute `start messenger-consume:messenger-consume_00`) in `supervisord` docker container when you'll finish your debugging (or you can simply restart environment using your local shell command `make restart`).
67 |
68 | ## External documentations
69 | * [Debugging PHP (web and cli) with Xdebug using Docker and PHPStorm](https://thecodingmachine.io/configuring-xdebug-phpstorm-docker)
70 | * [Debug your PHP in Docker with Intellij/PHPStorm and Xdebug](https://gist.github.com/jehaby/61a89b15571b4bceee2417106e80240d)
71 | * [Debugging with Postman and PHPStorm (Xdebug)](https://www.thinkbean.com/drupal-development-blog/debugging-postman-and-phpstorm-xdebug)
72 |
--------------------------------------------------------------------------------
/ecs.php:
--------------------------------------------------------------------------------
1 | paths([
33 | __DIR__ . '/src',
34 | __DIR__ . '/tests',
35 | ]);
36 |
37 | $ecsConfig->sets([SetList::PSR_12, SetList::CLEAN_CODE, SetList::COMMON]);
38 |
39 | $ruleConfigurations = [
40 | [
41 | IncrementStyleFixer::class,
42 | ['style' => 'post'],
43 | ],
44 | [
45 | YodaStyleFixer::class,
46 | [
47 | 'equal' => false,
48 | 'identical' => false,
49 | 'less_and_greater' => false,
50 | ],
51 | ],
52 | [
53 | ConcatSpaceFixer::class,
54 | ['spacing' => 'one'],
55 | ],
56 | [
57 | CastSpacesFixer::class,
58 | ['space' => 'none'],
59 | ],
60 | [
61 | OrderedImportsFixer::class,
62 | ['imports_order' => ['class', 'function', 'const']],
63 | ],
64 | [
65 | NoSuperfluousPhpdocTagsFixer::class,
66 | [
67 | 'remove_inheritdoc' => false,
68 | 'allow_mixed' => true,
69 | 'allow_unused_params' => false,
70 | ],
71 | ],
72 | [
73 | DeclareEqualNormalizeFixer::class,
74 | ['space' => 'none'],
75 | ],
76 | [
77 | BlankLineBeforeStatementFixer::class,
78 | ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
79 | ],
80 | [
81 | BinaryOperatorSpacesFixer::class,
82 | ['operators' => ['&' => 'align']],
83 | ],
84 | [
85 | // https://github.com/nunomaduro/phpinsights/blob/master/docs/insights/style.md#no-extra-blank-lines---
86 | NoExtraBlankLinesFixer::class,
87 | [
88 | 'tokens' =>
89 | [
90 | 'break',
91 | 'case',
92 | 'continue',
93 | 'curly_brace_block',
94 | 'default',
95 | 'extra',
96 | 'parenthesis_brace_block',
97 | 'return',
98 | 'square_brace_block',
99 | 'switch',
100 | 'throw',
101 | //'use',
102 | 'use_trait',
103 | ],
104 | ],
105 | ],
106 | [
107 | ClassDefinitionFixer::class,
108 | [
109 | 'multi_line_extends_each_single_line' => true,
110 | ],
111 | ],
112 | ];
113 |
114 | array_map(static fn ($parameters) => $ecsConfig->ruleWithConfiguration(...$parameters), $ruleConfigurations);
115 |
116 | $ecsConfig->skip([
117 | NoMultilineWhitespaceAroundDoubleArrowFixer::class => null,
118 | PhpdocNoPackageFixer::class => null,
119 | PhpdocSummaryFixer::class => null,
120 | PhpdocSeparationFixer::class => null,
121 | BlankLineAfterOpeningTagFixer::class => null,
122 | ClassAttributesSeparationFixer::class => null,
123 | NotOperatorWithSuccessorSpaceFixer::class => null,
124 | SingleLineThrowFixer::class => null,
125 | PhpdocAlignFixer::class => null,
126 | HeredocIndentationFixer::class => null,
127 | PhpdocToCommentFixer::class => null,
128 | NativeFunctionInvocationFixer::class => null,
129 | ]);
130 | };
131 |
--------------------------------------------------------------------------------
/importmap.php:
--------------------------------------------------------------------------------
1 | [
16 | 'path' => './assets/app.js',
17 | 'entrypoint' => true,
18 | ],
19 | '@hotwired/stimulus' => [
20 | 'version' => '3.2.2',
21 | ],
22 | '@symfony/stimulus-bundle' => [
23 | 'path' => './vendor/symfony/stimulus-bundle/assets/dist/loader.js',
24 | ],
25 | '@hotwired/turbo' => [
26 | 'version' => '7.3.0',
27 | ],
28 | ];
29 |
--------------------------------------------------------------------------------
/migrations/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/migrations/.gitignore
--------------------------------------------------------------------------------
/migrations/Version20190222213409.php:
--------------------------------------------------------------------------------
1 | abortIf(
44 | !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
45 | 'Migration can only be executed safely on \'mysql\'.'
46 | );
47 |
48 | $sql = <<addSql($sql);
73 |
74 | $this->addSql('ALTER TABLE scheduled_command ');
75 | }
76 |
77 | #[Override]
78 | public function down(Schema $schema): void
79 | {
80 | // this down() migration is auto-generated, please modify it to your needs
81 | $this->abortIf(
82 | !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
83 | 'Migration can only be executed safely on \'mysql\'.'
84 | );
85 |
86 | $this->addSql('DROP TABLE scheduled_command');
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/phpinsights.php:
--------------------------------------------------------------------------------
1 | 'symfony',
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Configuration
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may adjust all the various `Insights` that will be used by PHP
28 | | Insights. You can either add, remove or configure `Insights`. Keep in
29 | | mind, that all added `Insights` must belong to a specific `Metric`.
30 | |
31 | */
32 | 'exclude' => [
33 | 'bin',
34 | 'config',
35 | 'docker',
36 | 'docs',
37 | 'public',
38 | 'reports',
39 | 'migrations',
40 | 'templates',
41 | 'tests',
42 | 'tools',
43 | 'translations',
44 | 'var',
45 | 'vendor',
46 | ],
47 | 'add' => [
48 | ],
49 | 'remove' => [
50 | // ExampleInsight::class,
51 | NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerMustBeValid::class,
52 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses::class,
53 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits::class,
54 | NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::class,
55 | ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
56 | ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff::class,
57 | PhpCsFixer\Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer::class,
58 | SlevomatCodingStandard\Sniffs\Classes\SuperfluousExceptionNamingSniff::class,
59 | SlevomatCodingStandard\Sniffs\Classes\SuperfluousInterfaceNamingSniff::class,
60 | SlevomatCodingStandard\Sniffs\Classes\SuperfluousTraitNamingSniff::class,
61 | SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
62 | SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class,
63 | SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff::class,
64 | SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff ::class,
65 | SlevomatCodingStandard\Sniffs\Commenting\UselessFunctionDocCommentSniff::class,
66 | SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff::class,
67 | SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff::class,
68 | SlevomatCodingStandard\Sniffs\TypeHints\DisallowArrayTypeHintSyntaxSniff::class,
69 | SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff::class,
70 | SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff::class,
71 | SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::class,
72 | SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEmptySniff::class,
73 | PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\TodoSniff::class,
74 | ],
75 | 'config' => [
76 | SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class => [
77 | 'maxLinesLength' => 45,
78 | ],
79 | PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff::class => [
80 | 'lineLimit' => 120,
81 | 'absoluteLineLimit' => 140,
82 | 'ignoreComments' => true,
83 | ],
84 | PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff::class => [
85 | 'spacing' => 0,
86 | ],
87 | PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff::class => [
88 | 'spacing' => 0,
89 | ],
90 | PhpCsFixer\Fixer\CastNotation\CastSpacesFixer::class => [
91 | 'space' => 'none', // possible values ['single', 'none'],
92 | ],
93 | PhpCsFixer\Fixer\Import\OrderedImportsFixer::class => [
94 | 'imports_order' => ['class', 'function', 'const'],
95 | 'sort_algorithm' => 'alpha', // possible values ['alpha', 'length', 'none']
96 | ],
97 | PhpCsFixer\Fixer\LanguageConstruct\DeclareEqualNormalizeFixer::class => [
98 | 'space' => 'none', // possible values ['none', 'single']
99 | ],
100 | PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class => [
101 | 'operators' => [
102 | '&' => 'align',
103 | ],
104 | ],
105 | SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class => [
106 | 'exclude' => [
107 | 'src/MessageHandler/TestHandler.php',
108 | ],
109 | ],
110 | SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff::class => [
111 | 'searchAnnotations' => true,
112 | ],
113 | SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff::class => [
114 | 'linesCountBeforeDeclare' => 1,
115 | 'linesCountAfterDeclare' => 1,
116 | 'spacesCountAroundEqualsSign' => 1,
117 | ],
118 | SlevomatCodingStandard\Sniffs\Namespaces\UseSpacingSniff::class => [
119 | 'linesCountBeforeFirstUse' => 1,
120 | 'linesCountBetweenUseTypes' => 1,
121 | 'linesCountAfterLastUse' => 1,
122 | ],
123 | ],
124 | ];
125 |
--------------------------------------------------------------------------------
/phpmd_ruleset.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Custom rules for checking the project
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | parameters:
2 | level: max
3 | paths:
4 | - src
5 | - tests
6 | editorUrl: '%%file%%:%%line%%'
7 | symfony:
8 | containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml
9 | checkExplicitMixed: false
10 | #ignoreErrors:
11 | # - identifier: missingType.generics
12 | includes:
13 | - tools/02_phpstan/vendor/phpstan/phpstan/conf/bleedingEdge.neon
14 | - tools/02_phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
15 | - tools/02_phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
16 | - tools/02_phpstan/vendor/phpstan/phpstan-symfony/extension.neon
17 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 | ./src
26 |
27 |
28 | ./src/Command
29 | ./src/DataFixtures
30 | ./src/Kernel.php
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | ./tests/Application
46 |
47 |
48 | ./tests/Integration
49 |
50 |
51 | ./tests/Unit
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | paths([
11 | __DIR__ . '/config',
12 | __DIR__ . '/migrations',
13 | __DIR__ . '/public',
14 | __DIR__ . '/src',
15 | __DIR__ . '/tests',
16 | ]);
17 |
18 | $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
19 |
20 | // define sets of rules
21 | $rectorConfig->sets([
22 | LevelSetList::UP_TO_PHP_84,
23 | SymfonySetList::SYMFONY_71,
24 | SymfonySetList::SYMFONY_CODE_QUALITY,
25 | SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
26 | ]);
27 | };
28 |
--------------------------------------------------------------------------------
/reports/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/reports/.gitkeep
--------------------------------------------------------------------------------
/src/Command/WaitDatabaseCommand.php:
--------------------------------------------------------------------------------
1 | em->getConnection();
50 | $statement = $connection->prepare('SHOW TABLES');
51 | $statement->executeQuery();
52 | $output->writeln('Connection to the database is ok!');
53 |
54 | return 0;
55 | } catch (Throwable) {
56 | $output->writeln('Trying to connect to the database seconds:' . $i . '');
57 | sleep(self::WAIT_SLEEP_TIME);
58 |
59 | continue;
60 | }
61 | }
62 |
63 | $output->writeln('Can not connect to the database');
64 |
65 | return 1;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Controller/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/src/Controller/.gitignore
--------------------------------------------------------------------------------
/src/DataFixtures/AppFixtures.php:
--------------------------------------------------------------------------------
1 | persist($product);
16 |
17 | $manager->flush();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Entity/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/src/Entity/.gitignore
--------------------------------------------------------------------------------
/src/Kernel.php:
--------------------------------------------------------------------------------
1 | someId;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/MessageHandler/TestHandler.php:
--------------------------------------------------------------------------------
1 | handleMessage($message);
32 | }
33 |
34 | /**
35 | * @throws Throwable
36 | */
37 | private function handleMessage(TestMessage $message): void
38 | {
39 | $id = $message->getSomeId();
40 | // some actions here
41 | $this->logger->info('Test message processed with id: ' . $id);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Repository/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/src/Repository/.gitignore
--------------------------------------------------------------------------------
/src/Service/Interfaces/MessageServiceInterface.php:
--------------------------------------------------------------------------------
1 | bus->dispatch(new Envelope(new TestMessage($someId)));
28 |
29 | return $this;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/templates/Doctrine/migration.tpl:
--------------------------------------------------------------------------------
1 | ;
7 |
8 | use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
9 | use Doctrine\DBAL\Schema\Schema;
10 | use Doctrine\Migrations\AbstractMigration;
11 |
12 | /**
13 | * Auto-generated Migration: Please modify to your needs!
14 | */
15 | final class extends AbstractMigration
16 | {
17 | /**
18 | * @noinspection PhpMissingParentCallCommonInspection
19 | */
20 | public function getDescription(): string
21 | {
22 | return 'TODO: Describe reason for this migration';
23 | }
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | public function up(Schema $schema): void
29 | {
30 | // this up() migration is auto-generated, please modify it to your needs
31 | $this->abortIf(
32 | !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
33 | 'Migration can only be executed safely on \'mysql\'.'
34 | );
35 |
36 |
37 | }
38 |
39 | /**
40 | * @noinspection PhpMissingParentCallCommonInspection
41 | *
42 | * {@inheritdoc}
43 | */
44 | public function down(Schema $schema): void
45 | {
46 | // this down() migration is auto-generated, please modify it to your needs
47 | $this->abortIf(
48 | !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
49 | 'Migration can only be executed safely on \'mysql\'.'
50 | );
51 |
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/templates/base.html.twig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% block title %}Welcome!{% endblock %}
6 |
7 | {% block stylesheets %}
8 | {% endblock %}
9 |
10 | {% block javascripts %}
11 | {% block importmap %}{{ importmap('app') }}{% endblock %}
12 | {% endblock %}
13 |
14 |
15 | {% block body %}{% endblock %}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/Application/ExampleTest.php:
--------------------------------------------------------------------------------
1 | request('GET', '/command-scheduler/list');
24 | // check for 401 due to allow only for user with admin role
25 | static::assertSame(401, $client->getResponse()->getStatusCode());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tests/ApplicationTestCase.php:
--------------------------------------------------------------------------------
1 | bootEnv(dirname(__DIR__) . '/.env');
13 | }
14 |
--------------------------------------------------------------------------------
/tools/01_phpunit/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "phpunit/phpunit": "12.1.*",
9 | "symfony/browser-kit": "7.2.*",
10 | "symfony/css-selector": "7.2.*",
11 | "symfony/phpunit-bridge": "7.2.*",
12 | "roave/security-advisories": "dev-latest"
13 | },
14 | "config": {
15 | "allow-plugins": true,
16 | "platform": {
17 | "php": "8.4.0"
18 | },
19 | "preferred-install": {
20 | "*": "dist"
21 | },
22 | "sort-packages": true
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tools/02_phpstan/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "phpstan/phpstan": "2.1.*",
9 | "phpstan/phpstan-deprecation-rules": "2.0.*",
10 | "phpstan/phpstan-phpunit": "2.0.*",
11 | "phpstan/phpstan-symfony": "2.0.*",
12 | "roave/security-advisories": "dev-latest"
13 | },
14 | "config": {
15 | "allow-plugins": true,
16 | "platform": {
17 | "php": "8.4.0"
18 | },
19 | "preferred-install": {
20 | "*": "dist"
21 | },
22 | "sort-packages": true
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tools/03_ecs/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "friendsofphp/php-cs-fixer": "3.75.*",
9 | "squizlabs/php_codesniffer": "3.12.*",
10 | "symplify/easy-coding-standard": "12.5.*",
11 | "roave/security-advisories": "dev-latest"
12 | },
13 | "config": {
14 | "allow-plugins": true,
15 | "platform": {
16 | "php": "8.4.0"
17 | },
18 | "preferred-install": {
19 | "*": "dist"
20 | },
21 | "sort-packages": true
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tools/04_php-coveralls/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "php-coveralls/php-coveralls": "2.7.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tools/05_phpinsights/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "nunomaduro/phpinsights": "2.13.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tools/06_phpmd/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "phpmd/phpmd": "2.15.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tools/07_phpmetrics/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "phpmetrics/phpmetrics": "2.8.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tools/08_rector/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "rector/rector": "2.0.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tools/09_composer/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "ergebnis/composer-normalize": "^2.47",
9 | "icanhazstring/composer-unused": "^0.9",
10 | "maglnet/composer-require-checker": "^4.16",
11 | "roave/security-advisories": "dev-latest"
12 | },
13 | "config": {
14 | "allow-plugins": true,
15 | "platform": {
16 | "php": "8.4.0"
17 | },
18 | "preferred-install": {
19 | "*": "dist"
20 | },
21 | "sort-packages": true
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tools/10_phpcpd/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "systemsdk/docker-nginx-php-symfony-tools",
3 | "description": "",
4 | "require": {
5 | "php": "^8.4.0"
6 | },
7 | "require-dev": {
8 | "systemsdk/phpcpd": "8.2.*",
9 | "roave/security-advisories": "dev-latest"
10 | },
11 | "config": {
12 | "allow-plugins": true,
13 | "platform": {
14 | "php": "8.4.0"
15 | },
16 | "preferred-install": {
17 | "*": "dist"
18 | },
19 | "sort-packages": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/translations/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/translations/.gitignore
--------------------------------------------------------------------------------
/var/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/systemsdk/docker-nginx-php-symfony/40fb114ad0204eaf6d7d71ac8090cd1099513b07/var/.gitkeep
--------------------------------------------------------------------------------