7 Commits

Author SHA1 Message Date
2e35ab1038 doctine recipe 2026-02-06 09:45:54 +01:00
6e78a22896 symfony/timulus-bundle
recipe
2026-02-05 22:12:18 +01:00
32c9c3f8c7 symfony/security
recipe
2026-02-05 22:10:47 +01:00
731b445849 symfony/routing
recipe
2026-02-05 22:08:45 +01:00
47babe6777 symfony/phpunut
recipe
2026-02-05 22:07:05 +01:00
56497c6458 symfony/framework-bundle
recipe
2026-02-05 22:06:00 +01:00
c61e203a4d Update recipe for sentry 2026-02-05 22:01:40 +01:00
11 changed files with 68 additions and 53 deletions

7
.env
View File

@@ -17,6 +17,7 @@
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
APP_ENV=dev APP_ENV=dev
APP_SECRET= APP_SECRET=
APP_SHARE_DIR=var/share
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ### ###> doctrine/doctrine-bundle ###
@@ -37,3 +38,9 @@ MAILER_DSN=null://null
SENTRY_DSN= SENTRY_DSN=
###< sentry/sentry-symfony ### ###< sentry/sentry-symfony ###
XDEBUG_MODE=coverage XDEBUG_MODE=coverage
###> symfony/routing ###
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
DEFAULT_URI=http://localhost
###< symfony/routing ###

1
.gitattributes vendored
View File

@@ -15,3 +15,4 @@ composer.lock text eol=lf merge=ours
*.ico binary *.ico binary
*.png binary *.png binary
config/reference.php linguist-generated

View File

@@ -1,7 +1,9 @@
const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/; const nameCheck = /^[-_a-zA-Z0-9]{4,22}$/;
const tokenCheck = /^[-_\/+a-zA-Z0-9]{24,}$/; const tokenCheck = /^[-_/+a-zA-Z0-9]{24,}$/;
// Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager // Generate and double-submit a CSRF token in a form field and a cookie, as defined by Symfony's SameOriginCsrfTokenManager
// Use `form.requestSubmit()` to ensure that the submit event is triggered. Using `form.submit()` will not trigger the event
// and thus this event-listener will not be executed.
document.addEventListener('submit', function (event) { document.addEventListener('submit', function (event) {
generateCsrfToken(event.target); generateCsrfToken(event.target);
}, true); }, true);
@@ -33,8 +35,8 @@ export function generateCsrfToken (formElement) {
if (!csrfCookie && nameCheck.test(csrfToken)) { if (!csrfCookie && nameCheck.test(csrfToken)) {
csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken); csrfField.setAttribute('data-csrf-protection-cookie-value', csrfCookie = csrfToken);
csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18)))); csrfField.defaultValue = csrfToken = btoa(String.fromCharCode.apply(null, (window.crypto || window.msCrypto).getRandomValues(new Uint8Array(18))));
csrfField.dispatchEvent(new Event('change', { bubbles: true }));
} }
csrfField.dispatchEvent(new Event('change', { bubbles: true }));
if (csrfCookie && tokenCheck.test(csrfToken)) { if (csrfCookie && tokenCheck.test(csrfToken)) {
const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict'; const cookie = csrfCookie + '_' + csrfToken + '=' + csrfCookie + '; path=/; samesite=strict';

View File

@@ -0,0 +1,2 @@
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

View File

@@ -17,7 +17,6 @@ doctrine:
orm: orm:
enable_native_lazy_objects: true
validate_xml_mapping: true validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
identity_generation_preferences: identity_generation_preferences:
@@ -30,8 +29,6 @@ doctrine:
dir: '%kernel.project_dir%/src/Entity' dir: '%kernel.project_dir%/src/Entity'
prefix: 'Tvdt\Entity' prefix: 'Tvdt\Entity'
alias: Tvdt alias: Tvdt
controller_resolver:
auto_mapping: false
when@test: when@test:
doctrine: doctrine:

View File

@@ -2,7 +2,7 @@ framework:
router: router:
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands. # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost default_uri: '%env(DEFAULT_URI)%'
when@prod: when@prod:
framework: framework:

View File

@@ -2,6 +2,7 @@ security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers: password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers: providers:
# used to reload user from session & other features (e.g. switch_user) # used to reload user from session & other features (e.g. switch_user)
@@ -12,7 +13,8 @@ security:
# used to reload user from session & other features (e.g. switch_user) # used to reload user from session & other features (e.g. switch_user)
firewalls: firewalls:
dev: dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/ # Ensure dev tools and static assets are always allowed
pattern: ^/(_profiler|_wdt|assets|build)/
security: false security: false
main: main:
lazy: true lazy: true
@@ -33,8 +35,6 @@ security:
# https://symfony.com/doc/current/security/impersonating_user.html # https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true # switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control: access_control:
- { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/backoffice, roles: ROLE_USER } - { path: ^/backoffice, roles: ROLE_USER }
@@ -42,10 +42,8 @@ security:
when@test: when@test:
security: security:
password_hashers: password_hashers:
# By default, password hashers are resource intensive and take time. This is # Password hashers are resource-intensive by design to ensure security.
# important to generate secure password hashes. In tests however, secure hashes # In tests, it's safe to reduce their cost to improve performance.
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto algorithm: auto
cost: 4 # Lowest possible value for bcrypt cost: 4 # Lowest possible value for bcrypt

View File

@@ -10,7 +10,7 @@ when@prod:
- 'Symfony\Component\Debug\Exception\FatalErrorException' - 'Symfony\Component\Debug\Exception\FatalErrorException'
# #
# # If you are using Monolog, you also need this additional configuration to log the errors correctly: # # If you are using Monolog, you also need this additional configuration to log the errors correctly:
# # https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration # # https://docs.sentry.io/platforms/php/guides/symfony/integrations/monolog/
# register_error_listener: false # register_error_listener: false
# register_error_handler: false # register_error_handler: false
# #
@@ -19,18 +19,21 @@ when@prod:
# # Use this only if you don't want to use structured logging and instead receive # # Use this only if you don't want to use structured logging and instead receive
# # certain log levels as errors. # # certain log levels as errors.
# sentry: # sentry:
# type: sentry # type: service
# level: !php/const Monolog\Logger::ERROR # id: Sentry\Monolog\Handler
# hub_id: Sentry\State\HubInterface
# fill_extra_context: true # Enables sending monolog context to Sentry
# process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders
# #
# # Use this for structured log integration # # Use this for structured log integration
# sentry_logs: # sentry_logs:
# type: service # type: service
# id: Sentry\SentryBundle\Monolog\LogsHandler # id: Sentry\SentryBundle\Monolog\LogsHandler
# #
# # Enable one of the two services below, depending on your choice above
# services: # services:
# Sentry\Monolog\Handler:
# arguments:
# $hub: '@Sentry\State\HubInterface'
# $level: !php/const Monolog\Logger::ERROR
# $fillExtraContext: true # Enables sending monolog context to Sentry
# Sentry\SentryBundle\Monolog\LogsHandler: # Sentry\SentryBundle\Monolog\LogsHandler:
# arguments: # arguments:
# - !php/const Monolog\Logger::INFO # - !php/const Monolog\Logger::INFO

View File

@@ -1,5 +1,11 @@
# yaml-language-server: $schema=../vendor/symfony/routing/Loader/schema/routing.schema.json
# This file is the entry point to configure the routes of your app.
# Methods with the #[Route] attribute are automatically imported.
# See also https://symfony.com/doc/current/routing.html
# To list all registered routes, run the following command:
# bin/console debug:router
controllers: controllers:
resource: resource: routing.controllers
path: ../src/Controller/
namespace: Tvdt\Controller
type: attribute

View File

@@ -1,5 +1,8 @@
# yaml-language-server: $schema=../vendor/symfony/dependency-injection/Loader/schema/services.schema.json
# This file is the entry point to configure your own services. # This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies. # Files in the packages/ subdirectory configure your dependencies.
# See also https://symfony.com/doc/current/service_container/import.html
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration

View File

@@ -99,12 +99,12 @@
] ]
}, },
"sentry/sentry-symfony": { "sentry/sentry-symfony": {
"version": "5.6", "version": "5.8",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes-contrib", "repo": "github.com/symfony/recipes-contrib",
"branch": "main", "branch": "main",
"version": "5.0", "version": "5.0",
"ref": "b6cb4b34429dadecd7187852123be19d628fa37a" "ref": "12f504985eb24e3b20a9e41e0ec7e398798d18f0"
}, },
"files": [ "files": [
"config/packages/sentry.yaml" "config/packages/sentry.yaml"
@@ -184,14 +184,15 @@
] ]
}, },
"symfony/framework-bundle": { "symfony/framework-bundle": {
"version": "7.2", "version": "8.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "7.2", "version": "7.4",
"ref": "87bcf6f7c55201f345d8895deda46d2adbdbaa89" "ref": "09f6e081c763a206802674ce0cb34a022f0ffc6d"
}, },
"files": [ "files": [
".editorconfig",
"config/packages/cache.yaml", "config/packages/cache.yaml",
"config/packages/framework.yaml", "config/packages/framework.yaml",
"config/preload.php", "config/preload.php",
@@ -224,19 +225,14 @@
} }
}, },
"symfony/phpunit-bridge": { "symfony/phpunit-bridge": {
"version": "7.2", "version": "8.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "6.3", "version": "7.3",
"ref": "a411a0480041243d97382cac7984f7dce7813c08" "ref": "dc13fec96bd527bd399c3c01f0aab915c67fd544"
}, },
"files": [ "files": []
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
}, },
"symfony/property-info": { "symfony/property-info": {
"version": "7.3", "version": "7.3",
@@ -251,12 +247,12 @@
] ]
}, },
"symfony/routing": { "symfony/routing": {
"version": "7.2", "version": "8.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "7.0", "version": "7.4",
"ref": "21b72649d5622d8f7da329ffb5afb232a023619d" "ref": "bc94c4fd86f393f3ab3947c18b830ea343e51ded"
}, },
"files": [ "files": [
"config/packages/routing.yaml", "config/packages/routing.yaml",
@@ -264,12 +260,12 @@
] ]
}, },
"symfony/security-bundle": { "symfony/security-bundle": {
"version": "7.2", "version": "8.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "6.4", "version": "7.4",
"ref": "2ae08430db28c8eb4476605894296c82a642028f" "ref": "c42fee7802181cdd50f61b8622715829f5d2335c"
}, },
"files": [ "files": [
"config/packages/security.yaml", "config/packages/security.yaml",
@@ -277,18 +273,18 @@
] ]
}, },
"symfony/stimulus-bundle": { "symfony/stimulus-bundle": {
"version": "2.26", "version": "2.32",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "2.20", "version": "2.24",
"ref": "3acc494b566816514a6873a89023a35440b6386d" "ref": "3357f2fa6627b93658d8e13baa416b2a94a50c5f"
}, },
"files": [ "files": [
"assets/bootstrap.js",
"assets/controllers.json", "assets/controllers.json",
"assets/controllers/csrf_protection_controller.js", "assets/controllers/csrf_protection_controller.js",
"assets/controllers/hello_controller.js" "assets/controllers/hello_controller.js",
"assets/stimulus_bootstrap.js"
] ]
}, },
"symfony/translation": { "symfony/translation": {