Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/demo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.0
Choose a base ref
...
head repository: symfony/demo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 5,683 additions and 2,281 deletions.
  1. +7 −4 .devcontainer/devcontainer.json
  2. +10 −1 .editorconfig
  3. +6 −7 .env
  4. +1 −0 .env.dev
  5. +1 −1 .env.test
  6. +26 −20 .github/workflows/lint.yaml
  7. +8 −26 .github/workflows/tests.yaml
  8. +10 −1 .gitignore
  9. +0 −1 .php-cs-fixer.dist.php
  10. +11 −11 README.md
  11. +3 −5 assets/app.js
  12. +0 −1 assets/bootstrap.js
  13. +79 −0 assets/controllers/csrf_protection_controller.js
  14. +1 −0 assets/icons/tabler/arrow-left.svg
  15. +1 −0 assets/icons/tabler/arrow-right.svg
  16. +1 −0 assets/icons/tabler/ban.svg
  17. +1 −0 assets/icons/tabler/brand-x.svg
  18. +1 −0 assets/icons/tabler/calendar-month.svg
  19. +1 −0 assets/icons/tabler/code.svg
  20. +1 −0 assets/icons/tabler/device-floppy.svg
  21. +1 −0 assets/icons/tabler/eye.svg
  22. +1 −0 assets/icons/tabler/home.svg
  23. +1 −0 assets/icons/tabler/id-badge-2.svg
  24. +1 −0 assets/icons/tabler/key.svg
  25. +1 −0 assets/icons/tabler/list.svg
  26. +1 −0 assets/icons/tabler/lock.svg
  27. +1 −0 assets/icons/tabler/login.svg
  28. +1 −0 assets/icons/tabler/logout.svg
  29. +1 −0 assets/icons/tabler/message.svg
  30. +1 −0 assets/icons/tabler/messages.svg
  31. +1 −0 assets/icons/tabler/pencil.svg
  32. +1 −0 assets/icons/tabler/rss.svg
  33. +1 −0 assets/icons/tabler/search.svg
  34. +1 −0 assets/icons/tabler/send.svg
  35. +1 −0 assets/icons/tabler/settings.svg
  36. +1 −0 assets/icons/tabler/tag.svg
  37. +1 −0 assets/icons/tabler/tags.svg
  38. +1 −0 assets/icons/tabler/trash.svg
  39. +1 −0 assets/icons/tabler/user.svg
  40. +1 −0 assets/icons/tabler/users-group.svg
  41. +1 −0 assets/icons/tabler/world.svg
  42. +3 −4 assets/styles/app.scss
  43. +2 −2 assets/styles/bootswatch/_bootswatch.scss
  44. +2 −1 assets/styles/bootswatch/_variables.scss
  45. +4 −0 bin/console
  46. +0 −23 bin/phpunit
  47. +37 −37 composer.json
  48. +2,894 −1,409 composer.lock
  49. +1 −0 config/bundles.php
  50. +6 −0 config/packages/asset_mapper.yaml
  51. +11 −0 config/packages/csrf.yaml
  52. +7 −8 config/packages/doctrine.yaml
  53. +6 −19 config/packages/framework.yaml
  54. +1 −0 config/packages/monolog.yaml
  55. +0 −2 config/packages/routing.yaml
  56. +0 −7 config/packages/security.yaml
  57. +3 −3 config/packages/translation.yaml
  58. +1 −0 config/packages/twig.yaml
  59. +8 −0 config/packages/ux_icons.yaml
  60. +2 −6 config/routes.yaml
  61. +6 −5 config/services.yaml
  62. +3 −10 importmap.php
  63. +3 −62 phpstan-baseline.neon
  64. +23 −0 phpstan.dist.neon
  65. +0 −14 phpstan.neon.dist
  66. +19 −16 phpunit.xml.dist
  67. +3 −3 public/.htaccess
  68. +16 −12 src/Command/AddUserCommand.php
  69. +7 −4 src/Command/DeleteUserCommand.php
  70. +2 −2 src/Command/ListUsersCommand.php
  71. 0 var/sessions/.gitkeep → src/Controller/.gitignore
  72. +6 −5 src/Controller/Admin/BlogController.php
  73. +14 −14 src/Controller/BlogController.php
  74. +1 −1 src/Controller/SecurityController.php
  75. +1 −1 src/Controller/UserController.php
  76. +13 −19 src/DataFixtures/AppFixtures.php
  77. 0 src/Entity/.gitignore
  78. +5 −5 src/Entity/Comment.php
  79. +6 −5 src/Entity/Post.php
  80. +0 −16 src/Entity/User.php
  81. +1 −1 src/Event/CommentCreatedEvent.php
  82. +4 −4 src/EventSubscriber/CheckRequirementsSubscriber.php
  83. +6 −5 src/EventSubscriber/CommentNotificationSubscriber.php
  84. +2 −2 src/EventSubscriber/ControllerSubscriber.php
  85. +12 −17 src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php
  86. +4 −2 src/Form/DataTransformer/TagArrayToStringTransformer.php
  87. +1 −1 src/Form/PostType.php
  88. +2 −1 src/Form/Type/DateTimePickerType.php
  89. +2 −2 src/Form/Type/TagsInputType.php
  90. +1 −1 src/Kernel.php
  91. +1 −1 src/Pagination/Paginator.php
  92. 0 src/Repository/.gitignore
  93. +2 −2 src/Repository/PostRepository.php
  94. +4 −5 src/Security/PostVoter.php
  95. +6 −11 src/Twig/AppExtension.php
  96. +6 −7 src/Twig/SourceCodeExtension.php
  97. +128 −322 symfony.lock
  98. +1 −1 templates/admin/blog/_delete_form.html.twig
  99. +2 −2 templates/admin/blog/_form.html.twig
  100. +1 −1 templates/admin/blog/edit.html.twig
  101. +5 −5 templates/admin/blog/index.html.twig
  102. +2 −2 templates/admin/blog/new.html.twig
  103. +3 −3 templates/admin/blog/show.html.twig
  104. +2 −2 templates/admin/layout.html.twig
  105. +11 −11 templates/base.html.twig
  106. +2 −2 templates/blog/_comment_form.html.twig
  107. +2 −2 templates/blog/_delete_post_confirmation.html.twig
  108. +2 −2 templates/blog/_post.html.twig
  109. +1 −1 templates/blog/_post_tags.html.twig
  110. +1 −1 templates/blog/_rss.html.twig
  111. +4 −4 templates/blog/index.html.twig
  112. +1 −1 templates/blog/index.xml.twig
  113. +8 −6 templates/blog/post_show.html.twig
  114. +1 −1 templates/bundles/TwigBundle/Exception/error403.html.twig
  115. +2 −2 templates/debug/source_code.html.twig
  116. +4 −4 templates/default/_language_selector.html.twig
  117. +2 −2 templates/default/homepage.html.twig
  118. +2 −2 templates/form/fields.html.twig
  119. +12 −8 templates/security/login.html.twig
  120. +2 −2 templates/user/change_password.html.twig
  121. +2 −2 templates/user/edit.html.twig
  122. +1 −1 tests/Command/{AbstractCommandTest.php → AbstractCommandTestCase.php}
  123. +7 −7 tests/Command/AddUserCommandTest.php
  124. +4 −4 tests/Command/ListUsersCommandTest.php
  125. +3 −5 tests/Controller/Admin/BlogControllerTest.php
  126. +8 −9 tests/Controller/DefaultControllerTest.php
  127. +4 −6 tests/Controller/UserControllerTest.php
  128. +1 −3 tests/bootstrap.php
  129. +4 −0 translations/messages+intl-icu.ar.xlf
  130. +4 −0 translations/messages+intl-icu.bg.xlf
  131. +451 −0 translations/messages+intl-icu.bn.xlf
  132. +4 −0 translations/messages+intl-icu.bs.xlf
  133. +4 −0 translations/messages+intl-icu.ca.xlf
  134. +4 −0 translations/messages+intl-icu.cs.xlf
  135. +4 −0 translations/messages+intl-icu.de.xlf
  136. +4 −0 translations/messages+intl-icu.en.xlf
  137. +4 −0 translations/messages+intl-icu.es.xlf
  138. +4 −0 translations/messages+intl-icu.eu.xlf
  139. +4 −0 translations/messages+intl-icu.fr.xlf
  140. +4 −0 translations/messages+intl-icu.hr.xlf
  141. +4 −0 translations/messages+intl-icu.id.xlf
  142. +4 −0 translations/messages+intl-icu.it.xlf
  143. +4 −0 translations/messages+intl-icu.ja.xlf
  144. +4 −0 translations/messages+intl-icu.lt.xlf
  145. +451 −0 translations/messages+intl-icu.ne.xlf
  146. +4 −0 translations/messages+intl-icu.nl.xlf
  147. +4 −0 translations/messages+intl-icu.pl.xlf
  148. +4 −0 translations/messages+intl-icu.pt_BR.xlf
  149. +4 −0 translations/messages+intl-icu.ro.xlf
  150. +4 −0 translations/messages+intl-icu.ru.xlf
  151. +4 −0 translations/messages+intl-icu.sk.xlf
  152. +4 −0 translations/messages+intl-icu.sl.xlf
  153. +461 −0 translations/messages+intl-icu.sq.xlf
  154. +4 −0 translations/messages+intl-icu.sr_Cyrl.xlf
  155. +4 −0 translations/messages+intl-icu.sr_Latn.xlf
  156. +4 −0 translations/messages+intl-icu.tr.xlf
  157. +4 −0 translations/messages+intl-icu.uk.xlf
  158. +439 −0 translations/messages+intl-icu.vi.xlf
  159. +4 −0 translations/messages+intl-icu.zh_CN.xlf
  160. +43 −0 translations/validators+intl-icu.bn.xlf
  161. +43 −0 translations/validators+intl-icu.ne.xlf
  162. +53 −0 translations/validators+intl-icu.sq.xlf
  163. +43 −0 translations/validators+intl-icu.vi.xlf
11 changes: 7 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -3,15 +3,18 @@
"features": {
"ghcr.io/shyim/devcontainers-features/symfony-cli:0": {},
"ghcr.io/shyim/devcontainers-features/php:0": {
"version": "8.1"
},
"version": "8.4"
}
},
"updateContentCommand": {
"composer install": ["composer", "install"],
"importmap:install": ["symfony", "console", "importmap:install"]
"composer install": ["composer", "install"]
},
"postAttachCommand": {
"server": "symfony server:start",
"sass build": ["symfony", "console", "sass:build", "-w"]
},
"containerEnv": {
"SYMFONY_TRUSTED_PROXIES": "127.0.0.1",
"SYMFONY_TRUSTED_HEADERS": "x-forwarded-for,x-forwarded-host,x-forwarded-proto,x-forwarded-port"
}
}
11 changes: 10 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -3,8 +3,17 @@ root = true

; Unix-style newlines
[*]
charset = utf-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true

[*.php]
[*.{php,html,twig}]
indent_style = space
indent_size = 4

[*.md]
max_line_length = 80

[COMMIT_EDITMSG]
max_line_length = 0
13 changes: 6 additions & 7 deletions .env
Original file line number Diff line number Diff line change
@@ -16,20 +16,19 @@

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=2ca64f8d83b9e89f5f19d672841d6bb8
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
APP_SECRET=
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
DATABASE_URL="sqlite:///%kernel.project_dir%/data/database.sqlite"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/mailer ###
# MAILER_DSN=null://null
MAILER_DSN=null://null
###< symfony/mailer ###
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Define your env variables for the development environment here
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# define your env variables for the test env here
# Define your env variables for the test environment here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
46 changes: 26 additions & 20 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
@@ -34,7 +34,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
@@ -44,23 +44,9 @@ jobs:
php-version: ${{ matrix.php-version }}
tools: composer:v2

- name: "Set composer cache directory"
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache composer"
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install dependencies"
run: composer install --ansi --no-interaction --no-progress

- name: Install PHPUnit
id: install
run: vendor/bin/simple-phpunit install
run: composer install --ansi --no-interaction --no-progress

- name: Lint YAML files
if: always() && steps.install.outcome == 'success'
@@ -70,10 +56,14 @@ jobs:
if: always() && steps.install.outcome == 'success'
run: ./bin/console lint:twig templates --env=prod

- name: Lint XLIFF translations
- name: Lint XLIFF translation files
if: always() && steps.install.outcome == 'success'
run: ./bin/console lint:xliff translations

- name: Lint translation contents
if: always() && steps.install.outcome == 'success'
run: ./bin/console lint:translations

- name: Lint Parameters and Services
if: always() && steps.install.outcome == 'success'
run: ./bin/console lint:container --no-debug
@@ -90,6 +80,22 @@ jobs:
if: always() && steps.install.outcome == 'success'
run: composer audit

static-analysis:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.3'

- name: Install dependencies
run: composer install --ansi --no-interaction --no-progress

- name: Run PHPStan
if: always() && steps.install.outcome == 'success'
run: ./vendor/bin/phpstan analyze
run: vendor/bin/phpstan analyze --no-progress
34 changes: 8 additions & 26 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@ on:

env:
fail-fast: true
PHPUNIT_FLAGS: "-v"
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
SYMFONY_DEPRECATIONS_HELPER: 0

permissions:
contents: read
@@ -24,7 +21,7 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-version: ['8.2', '8.3']
php-version: ['8.2', '8.3', '8.4']
include:
- operating-system: 'macos-latest'
php-version: '8.2'
@@ -33,7 +30,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
@@ -46,29 +43,14 @@ jobs:
- name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: "Set composer cache directory"
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash

- name: "Cache composer"
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install dependencies"
run: composer install --ansi --no-interaction --no-progress

- name: "Build Sass"
run: php bin/console sass:build

- name: "Install PHPUnit"
run: vendor/bin/simple-phpunit install

- name: "PHPUnit version"
run: vendor/bin/simple-phpunit --version
- name: "Build and compile assets"
run: |
php bin/console importmap:install
php bin/console sass:build
php bin/console asset-map:compile
- name: "Run tests"
run: vendor/bin/simple-phpunit ${{ env.PHPUNIT_FLAGS }}
run: vendor/bin/phpunit
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -20,5 +20,14 @@

###> symfony/asset-mapper ###
/public/assets/
/assets/vendor
/assets/vendor/
###< symfony/asset-mapper ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
->exclude('public/bundles')
->exclude('public/build')
// exclude files generated by Symfony Flex recipes
->notPath('bin/console')
->notPath('public/index.php')
->notPath('importmap.php')
;
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -22,20 +22,20 @@ There are 3 different ways of installing this project depending on your needs:
on your computer to run this command:

```bash
$ symfony new --demo my_project
symfony new --demo my_project
```

**Option 2.** [Download Composer][6] and use the `composer` binary installed
on your computer to run these commands:

```bash
# you can create a new project based on the Symfony Demo project...
$ composer create-project symfony/symfony-demo my_project
composer create-project symfony/symfony-demo my_project

# ...or you can clone the code repository and install its dependencies
$ git clone https://github.com/symfony/demo.git my_project
$ cd my_project/
$ composer install
git clone https://github.com/symfony/demo.git my_project
cd my_project/
composer install
```

**Option 3.** Click the following button to deploy this project on Platform.sh,
@@ -54,8 +54,8 @@ There's no need to configure anything before running the application. There are
**Option 1.** [Download Symfony CLI][4] and run this command:

```bash
$ cd my_project/
$ symfony serve
cd my_project/
symfony serve
```

Then access the application in your browser at the given URL (<https://localhost:8000> by default).
@@ -66,8 +66,8 @@ Then access the application in your browser at the given URL (<https://localhost
On your local machine, you can run this command to use the built-in PHP web server:

```bash
$ cd my_project/
$ php -S localhost:8000 -t public/
cd my_project/
php -S localhost:8000 -t public/
```

Tests
@@ -76,8 +76,8 @@ Tests
Execute this command to run tests:

```bash
$ cd my_project/
$ ./bin/phpunit
cd my_project/
./bin/phpunit
```

[1]: https://symfony.com/doc/current/best_practices.html
8 changes: 3 additions & 5 deletions assets/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// start the Stimulus application
import './bootstrap.js';
import './styles/app.scss';
import '@fortawesome/fontawesome-free/css/all.css';
import '@fortawesome/fontawesome-free/css/v4-shims.css';
import 'highlight.js/styles/github-dark-dimmed.css';
import 'lato-font/css/lato-font.css';

@@ -18,7 +18,5 @@ import './js/highlight.js';
// Creates links to the Symfony documentation
import './js/doclinks.js';

// start the Stimulus application
import './bootstrap.js';

import './js/flatpicker.js';

1 change: 0 additions & 1 deletion assets/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { startStimulusApp } from '@symfony/stimulus-bundle';

const app = startStimulusApp();

// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);
Loading