Compare commits

..

No commits in common. "master" and "3_start_new-project" have entirely different histories.

50 changed files with 4979 additions and 4554 deletions

9
.gitignore vendored
View File

@ -1,13 +1,10 @@
# Uncomment to ignore Symfony project # Uncomment to ignore Symfony project
#/app/* #/app/*
/app/.yarncache
!/app/.keep !/app/.keep
# Uncomment to ignore Database datas # Uncomment to ignore Database datas
data /data/*
!/data/.keep
# yarn
/app/.yarncache
# phpstorm
.idea .idea

128
README.md
View File

@ -1,111 +1,47 @@
Environnement de développement Docker pour démarrer un nouveau projet Symfony5 Environnement de développement Docker pour démarrer un nouveau projet Symfony5
================================== ==================================
## En partant de la branche *5_start_new-project* # Présentation
Le projet, symfony et ses dépendances sont prêt à être installé. L'objectif de ce dépôt est de proposer et de faire évoluer une configuration de départ pour démarrer très simplement un nouveau projet Symfony dans des conteneurs Docker.
``` En suivant pas-à-pas les instructions à partir du chapitre "Installation", on peut démarrer en quelques minutes un nouveau projet.
$ docker-compose build
$ docker-compose up -d
$ docker-compose exec -u 1000 php bash
```
dans le conteneur php : Le dépôt propose plusieurs branches qui peuvent être utilisées selon le point de départ recherché:
``` ## 1_docker_ready
$ composer install
$ bin/console doctrine:schema:create
```
et pour node : La branche `1_docker_ready` fournit juste le docker-compose.yml et les Dockerfile qui permettent de construire les conteneurs.
``` * `$ cd my-project-dir`
$ bash docker-node.sh yarn install --force * `$ docker-compose build`
$ bash docker-node.sh yarn encore dev-server * `$ docker-compose up -d`
``` * `$ docker-compose exec -u 1000 php bash`
Voilà, le site est disponible sur http://localhost:8000 A ce stade les commandes `composer` et `symfony` sont disponibles pour lancer la création du projet.
Après ça on choisira dans le fichier `app/.env` le type de base de donnée. Un conteneur est prévu pour utiliser postgresql.
## 2_symfony_demo
## En partant de la branche *1_docker_ready* * commandes exécutées:
* `$ symfony new --demo demo`
* `$ mv demo/* . && mv demo/.* . && rmdir demo`
### 1. Se mettre sur la bonne branche Cette branche démarre d'une installation toute prête de la demo Symfony. La db est enregistrée dans le repo dans un simple fichier sqlite (`app/data/database.sqlite`). Le conteneur docker postgresql est donc désactivé.
```bash ## 3_start_new_project
$ git co -b 1_docker_ready origin/1_docker_ready
```
### 2. Construire les images et les conteneurs * commandes exécutées:
* `$ symfony new myproject`
```bash * `$ mv myproject/* . && mv myproject/.* . && rmdir myproject`
$ docker-compose build * `composer require annotations twig orm form form validator maker-bundle security-csrf \
$ docker-compose up && composer require --dev profiler`
.. 221001_test3_db_1 exited with code 1 * Adapt querystring in `./app/.env`:
``` ```
--- DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
### 3. Parce que 'db' ne se lance pas: +++ DATABASE_URL="postgresql://postgres:secret@db:5432/postgres?serverVersion=12&charset=utf8"
```
```bash * Create database schema: `bin/console doctrine:schema:create`
$ docker-compose rm db * `$ composer require symfony/webpack-encore-bundle` and `$ yarn install --force`
$ sudo rm -rf ./data * `$ yarn add sass sass-loader`
$ docker-compose up db * `$ composer require --dev symfony/debug-bundle symfony/var-dumper`
```
### 4. Entrer dans le conteneur php
```bash
$ docker-compose exec -u 1000 php bash
```
### 5. Créer le projet
```bash
$ symfony new project
$ mv project/* . && mv project/.* . && rmdir project
```
### 6. Charger les dépendances de composer
```bash
$ composer require doctrine/annotations twig/twig doctrine/orm symfony/orm-pack symfony/form symfony/maker-bundle symfony/security-csrf
```
### 7. Connexion à postgresql
modifier DATABASE_URL dans app/.env :
```bash
+++ DATABASE_URL="postgresql://postgres:secret@db:5432/postgres?serverVersion=12&charset=utf8"
```
et dans le conteneur php :
```bash
$ bin/console doctrine:schema:create
```
### 8. Chargement de dépendances, la suite
```bash
$ composer require symfony/yaml symfony/twig-bridge symfony/validator
$ composer require symfony/asset symfony/expression-language symfony/security-http symfony/translation symfony/web-link egulias/email-validator symfony/expression-language symfony/intl symfony/translation
$ composer require --dev symfony/profiler-pack symfony/debug-bundle symfony/var-dumper
```
### 9. Installer node et yarn
```bash
$ composer require symfony/webpack-encore-bundle
```
mettre en place le script qui lance docker node, le lancer pour entrer dans le conteneur node:
```bash
$ yarn install --force
$ yarn add sass sass-loader
$ yarn encore dev-server
```
### 10. C'est installé !
le site est disponible sur http://localhost:8000

View File

@ -9,14 +9,13 @@
# Real environment variables win over .env files. # Real environment variables win over .env files.
# #
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
# #
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
APP_ENV=dev APP_ENV=dev
APP_SECRET=0751e183ea472eb11c19f21f66a2543c APP_SECRET=d6c584c628f4a555632b6e2c1382502a
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ### ###> doctrine/doctrine-bundle ###
@ -24,6 +23,6 @@ APP_SECRET=0751e183ea472eb11c19f21f66a2543c
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
# #
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4" # DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8" DATABASE_URL="postgresql://postgres:secret@db:5432/postgres?serverVersion=12&charset=utf8"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###

View File

@ -8,5 +8,8 @@
// any CSS you import will output into a single css file (app.css in this case) // any CSS you import will output into a single css file (app.css in this case)
import './styles/app.css'; import './styles/app.css';
// SCSS
import './styles/app.scss';
// start the Stimulus application // start the Stimulus application
import './bootstrap'; import './bootstrap';

View File

@ -4,7 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context( export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers', '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true, true,
/\.[jt]sx?$/ /\.(j|t)sx?$/
)); ));
// register any custom, 3rd party controllers here // register any custom, 3rd party controllers here

View File

@ -1,4 +1,4 @@
import { Controller } from '@hotwired/stimulus'; import { Controller } from 'stimulus';
/* /*
* This is an example Stimulus controller! * This is an example Stimulus controller!

View File

@ -3,15 +3,41 @@
use App\Kernel; use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
} }
require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; set_time_limit(0);
return function (array $context) { require dirname(__DIR__).'/vendor/autoload.php';
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
return new Application($kernel); if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
}; throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);

View File

@ -1,45 +1,33 @@
{ {
"type": "project", "type": "project",
"license": "proprietary", "license": "proprietary",
"minimum-stability": "stable", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"doctrine/annotations": "^1.13", "composer/package-versions-deprecated": "1.11.99.1",
"doctrine/doctrine-bundle": "^2.7", "doctrine/doctrine-bundle": "^2.3",
"doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.13", "doctrine/orm": "^2.8",
"egulias/email-validator": "^3.2", "sensio/framework-extra-bundle": "^6.1",
"sensio/framework-extra-bundle": "^6.2", "symfony/console": "5.2.*",
"symfony/asset": "^5.4", "symfony/dotenv": "5.2.*",
"symfony/console": "5.4.*", "symfony/flex": "^1.3.1",
"symfony/dotenv": "5.4.*", "symfony/form": "5.2.*",
"symfony/expression-language": "^5.4", "symfony/framework-bundle": "5.2.*",
"symfony/flex": "^1.17|^2", "symfony/maker-bundle": "^1.30",
"symfony/form": "^5.4", "symfony/proxy-manager-bridge": "5.2.*",
"symfony/framework-bundle": "5.4.*", "symfony/security-csrf": "5.2.*",
"symfony/intl": "^5.4", "symfony/twig-bundle": "5.2.*",
"symfony/maker-bundle": "^1.43", "symfony/validator": "5.2.*",
"symfony/proxy-manager-bridge": "5.4.*", "symfony/webpack-encore-bundle": "^1.11",
"symfony/runtime": "5.4.*", "symfony/yaml": "5.2.*",
"symfony/security-csrf": "^5.4", "twig/extra-bundle": "^2.12|^3.0",
"symfony/security-http": "^5.4", "twig/twig": "^2.12|^3.0"
"symfony/translation": "^5.4",
"symfony/twig-bridge": "^5.4",
"symfony/validator": "^5.4",
"symfony/web-link": "^5.4",
"symfony/webpack-encore-bundle": "^1.15",
"symfony/yaml": "^5.4",
"twig/twig": "^3.4"
}, },
"config": { "config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"symfony/flex": true,
"symfony/runtime": true
},
"optimize-autoloader": true, "optimize-autoloader": true,
"preferred-install": { "preferred-install": {
"*": "dist" "*": "dist"
@ -79,13 +67,13 @@
"extra": { "extra": {
"symfony": { "symfony": {
"allow-contrib": false, "allow-contrib": false,
"require": "5.4.*" "require": "5.2.*"
} }
}, },
"require-dev": { "require-dev": {
"symfony/debug-bundle": "^5.4", "symfony/debug-bundle": "5.2.*",
"symfony/stopwatch": "5.4.*", "symfony/stopwatch": "^5.2",
"symfony/var-dumper": "^5.4", "symfony/var-dumper": "5.2.*",
"symfony/web-profiler-bundle": "5.4.*" "symfony/web-profiler-bundle": "^5.2"
} }
} }

3213
app/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,13 @@
return [ return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
]; ];

View File

@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

View File

@ -1,5 +0,0 @@
when@dev:
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View File

@ -0,0 +1,4 @@
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View File

@ -0,0 +1,6 @@
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }

View File

@ -1,10 +1,11 @@
doctrine: doctrine:
dbal: dbal:
override_url: true
url: '%env(resolve:DATABASE_URL)%' url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version, # IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file) # either here or in the DATABASE_URL env var (see .env file)
#server_version: '15' #server_version: '13'
orm: orm:
auto_generate_proxy_classes: true auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
@ -12,32 +13,7 @@ doctrine:
mappings: mappings:
App: App:
is_bundle: false is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity' dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity' prefix: 'App\Entity'
alias: App alias: App
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View File

@ -3,4 +3,4 @@ doctrine_migrations:
# namespace is arbitrary but should be different from App\Migrations # namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded # as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations' 'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false enable_profiler: '%kernel.debug%'

View File

@ -2,7 +2,7 @@
framework: framework:
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
#csrf_protection: true #csrf_protection: true
http_method_override: false #http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it. # Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support. # Remove or comment this section to explicitly disable session support.
@ -10,15 +10,8 @@ framework:
handler_id: null handler_id: null
cookie_secure: auto cookie_secure: auto
cookie_samesite: lax cookie_samesite: lax
storage_factory_id: session.storage.factory.native
#esi: true #esi: true
#fragments: true #fragments: true
php_errors: php_errors:
log: true log: true
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file

View File

@ -0,0 +1,20 @@
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View File

@ -0,0 +1,3 @@
framework:
router:
strict_requirements: null

View File

@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

View File

@ -5,8 +5,3 @@ framework:
# 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: http://localhost
when@prod:
framework:
router:
strict_requirements: null

View File

@ -0,0 +1,7 @@
#doctrine:
# dbal:
# # Overrides the database name in the test environment only
# # "host", "port", "user", & "password" can also be set to override their respective url parts
# #
# # If you're using ParaTest, "TEST_TOKEN" is set by ParaTest otherwise nothing is appended to the database name.
# dbname: main_test%env(default::TEST_TOKEN)%

View File

@ -0,0 +1,4 @@
framework:
test: true
session:
storage_id: session.storage.mock_file

View File

@ -0,0 +1,2 @@
twig:
strict_variables: true

View File

@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false

View File

@ -0,0 +1,6 @@
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }

View File

@ -0,0 +1,2 @@
#webpack_encore:
# strict_mode: false

View File

@ -1,13 +0,0 @@
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
# providers:
# crowdin:
# dsn: '%env(CROWDIN_DSN)%'
# loco:
# dsn: '%env(LOCO_DSN)%'
# lokalise:
# dsn: '%env(LOKALISE_DSN)%'

View File

@ -1,6 +1,2 @@
twig: twig:
default_path: '%kernel.project_dir%/templates' default_path: '%kernel.project_dir%/templates'
when@test:
twig:
strict_variables: true

View File

@ -6,8 +6,3 @@ framework:
# For instance, basic validation constraints will be inferred from Doctrine's metadata. # For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping: #auto_mapping:
# App\Entity\: [] # App\Entity\: []
when@test:
framework:
validation:
not_compromised_password: false

View File

@ -1,15 +0,0 @@
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }
when@test:
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }

View File

@ -7,12 +7,7 @@ webpack_encore:
# Set attributes that will be rendered on all script and link tags # Set attributes that will be rendered on all script and link tags
script_attributes: script_attributes:
defer: true defer: true
# Uncomment (also under link_attributes) if using Turbo Drive
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
# 'data-turbo-track': reload
# link_attributes: # link_attributes:
# Uncomment if using Turbo Drive
# 'data-turbo-track': reload
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials') # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous' # crossorigin: 'anonymous'
@ -25,21 +20,11 @@ webpack_encore:
# If you have multiple builds: # If you have multiple builds:
# builds: # builds:
# frontend: '%kernel.project_dir%/public/frontend/build' # pass "frontend" as the 3rg arg to the Twig functions
# pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }} # {{ encore_entry_script_tags('entry1', null, 'frontend') }}
framework: # frontend: '%kernel.project_dir%/public/frontend/build'
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
#when@prod: # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# webpack_encore: # Put in config/packages/prod/webpack_encore.yaml
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) # cache: true
# # Available in version 1.2
# cache: true
#when@test:
# webpack_encore:
# strict_mode: false

View File

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -0,0 +1,7 @@
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@ -1,4 +0,0 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -1,8 +0,0 @@
when@dev:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@ -2,7 +2,7 @@
# Files in the packages/ subdirectory configure your dependencies. # Files in the packages/ subdirectory configure your dependencies.
# 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/configuration.html#application-related-configuration
parameters: parameters:
services: services:
@ -19,6 +19,13 @@ services:
- '../src/DependencyInjection/' - '../src/DependencyInjection/'
- '../src/Entity/' - '../src/Entity/'
- '../src/Kernel.php' - '../src/Kernel.php'
- '../src/Tests/'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller/'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed # add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones # please note that last definitions always *replace* previous ones

View File

@ -1,8 +0,0 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###

View File

@ -1,21 +0,0 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-15}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
volumes:
###> doctrine/doctrine-bundle ###
database_data:
###< doctrine/doctrine-bundle ###

View File

@ -1,15 +1,11 @@
{ {
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.0", "@symfony/stimulus-bridge": "^2.0.0",
"@babel/preset-env": "^7.16.0", "@symfony/webpack-encore": "^1.0.0",
"@hotwired/stimulus": "^3.0.0", "core-js": "^3.0.0",
"@symfony/stimulus-bridge": "^3.2.0", "regenerator-runtime": "^0.13.2",
"@symfony/webpack-encore": "^4.0.0", "stimulus": "^2.0.0",
"core-js": "^3.23.0", "webpack-notifier": "^1.6.0"
"regenerator-runtime": "^0.13.9",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-notifier": "^1.15.0"
}, },
"license": "UNLICENSED", "license": "UNLICENSED",
"private": true, "private": true,
@ -18,5 +14,9 @@
"dev": "encore dev", "dev": "encore dev",
"watch": "encore dev --watch", "watch": "encore dev --watch",
"build": "encore production --progress" "build": "encore production --progress"
},
"dependencies": {
"sass": "^1.32.10",
"sass-loader": "^11.0.1"
} }
} }

View File

@ -1,9 +1,22 @@
<?php <?php
use App\Kernel; use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; require dirname(__DIR__).'/vendor/autoload.php';
return function (array $context) { (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
}; if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

View File

@ -3,9 +3,36 @@
namespace App; namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
protected function configureContainer(ContainerConfigurator $container): void
{
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
$container->import('../config/services.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
(require $path)($container->withPath($path), $this);
}
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
$routes->import('../config/{routes}/*.yaml');
if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
$routes->import('../config/routes.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
(require $path)($routes->withPath($path), $this);
}
}
} }

View File

@ -1,9 +1,12 @@
{ {
"composer/package-versions-deprecated": {
"version": "1.11.99.1"
},
"doctrine/annotations": { "doctrine/annotations": {
"version": "1.13", "version": "1.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "1.0", "version": "1.0",
"ref": "a2759dd6123694c8d901d0ec80006e044c2e6457" "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
}, },
@ -11,38 +14,106 @@
"config/routes/annotations.yaml" "config/routes/annotations.yaml"
] ]
}, },
"doctrine/cache": {
"version": "1.10.2"
},
"doctrine/collections": {
"version": "1.6.7"
},
"doctrine/common": {
"version": "3.1.2"
},
"doctrine/dbal": {
"version": "2.13.0"
},
"doctrine/deprecations": {
"version": "v0.5.3"
},
"doctrine/doctrine-bundle": { "doctrine/doctrine-bundle": {
"version": "2.7", "version": "2.3",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "2.4", "version": "2.3",
"ref": "013b823e7fee65890b23e40f31e6667a1ac519ac" "ref": "6e0f582596a8f1c865aaa0d3cceb9bf0daf609b4"
}, },
"files": [ "files": [
"config/packages/doctrine.yaml", "config/packages/doctrine.yaml",
"config/packages/prod/doctrine.yaml",
"config/packages/test/doctrine.yaml",
"src/Entity/.gitignore", "src/Entity/.gitignore",
"src/Repository/.gitignore" "src/Repository/.gitignore"
] ]
}, },
"doctrine/doctrine-migrations-bundle": { "doctrine/doctrine-migrations-bundle": {
"version": "3.2", "version": "3.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "3.1", "version": "3.1",
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33" "ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
}, },
"files": [ "files": [
"config/packages/doctrine_migrations.yaml", "config/packages/doctrine_migrations.yaml",
"migrations/.gitignore" "migrations/.gitignore"
] ]
}, },
"doctrine/event-manager": {
"version": "1.1.1"
},
"doctrine/inflector": {
"version": "2.0.3"
},
"doctrine/instantiator": {
"version": "1.4.0"
},
"doctrine/lexer": {
"version": "1.2.1"
},
"doctrine/migrations": {
"version": "3.1.1"
},
"doctrine/orm": {
"version": "2.8.4"
},
"doctrine/persistence": {
"version": "2.1.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.3"
},
"laminas/laminas-code": {
"version": "3.4.1"
},
"laminas/laminas-eventmanager": {
"version": "3.3.1"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.2.0"
},
"nikic/php-parser": {
"version": "v4.10.4"
},
"psr/cache": {
"version": "1.0.1"
},
"psr/container": {
"version": "1.1.1"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.1.3"
},
"sensio/framework-extra-bundle": { "sensio/framework-extra-bundle": {
"version": "6.2", "version": "5.2",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.2", "version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
}, },
@ -50,141 +121,253 @@
"config/packages/sensio_framework_extra.yaml" "config/packages/sensio_framework_extra.yaml"
] ]
}, },
"symfony/asset": {
"version": "v5.2.4"
},
"symfony/cache": {
"version": "v5.2.6"
},
"symfony/cache-contracts": {
"version": "v2.2.0"
},
"symfony/config": {
"version": "v5.2.4"
},
"symfony/console": { "symfony/console": {
"version": "5.4", "version": "5.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.3", "version": "5.1",
"ref": "da0c8be8157600ad34f10ff0c9cc91232522e047" "ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
}, },
"files": [ "files": [
"bin/console" "bin/console"
] ]
}, },
"symfony/debug-bundle": { "symfony/debug-bundle": {
"version": "5.4", "version": "4.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.3", "version": "4.1",
"ref": "5aa8aa48234c8eb6dbdd7b3cd5d791485d2cec4b" "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea"
}, },
"files": [ "files": [
"config/packages/debug.yaml" "config/packages/dev/debug.yaml"
] ]
}, },
"symfony/dependency-injection": {
"version": "v5.2.6"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
"version": "v5.2.6"
},
"symfony/dotenv": {
"version": "v5.2.4"
},
"symfony/error-handler": {
"version": "v5.2.6"
},
"symfony/event-dispatcher": {
"version": "v5.2.4"
},
"symfony/event-dispatcher-contracts": {
"version": "v2.2.0"
},
"symfony/filesystem": {
"version": "v5.2.6"
},
"symfony/finder": {
"version": "v5.2.4"
},
"symfony/flex": { "symfony/flex": {
"version": "1.19", "version": "1.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "1.0", "version": "1.0",
"ref": "146251ae39e06a95be0fe3d13c807bcf3938b172" "ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
}, },
"files": [ "files": [
".env" ".env"
] ]
}, },
"symfony/form": {
"version": "v5.2.6"
},
"symfony/framework-bundle": { "symfony/framework-bundle": {
"version": "5.4", "version": "5.2",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.4", "version": "5.2",
"ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb" "ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
}, },
"files": [ "files": [
"config/packages/cache.yaml", "config/packages/cache.yaml",
"config/packages/framework.yaml", "config/packages/framework.yaml",
"config/packages/test/framework.yaml",
"config/preload.php", "config/preload.php",
"config/routes/framework.yaml", "config/routes/dev/framework.yaml",
"config/services.yaml", "config/services.yaml",
"public/index.php", "public/index.php",
"src/Controller/.gitignore", "src/Controller/.gitignore",
"src/Kernel.php" "src/Kernel.php"
] ]
}, },
"symfony/http-client-contracts": {
"version": "v2.3.1"
},
"symfony/http-foundation": {
"version": "v5.2.4"
},
"symfony/http-kernel": {
"version": "v5.2.6"
},
"symfony/intl": {
"version": "v5.2.4"
},
"symfony/maker-bundle": { "symfony/maker-bundle": {
"version": "1.43", "version": "1.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "1.0", "version": "1.0",
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
} }
}, },
"symfony/options-resolver": {
"version": "v5.2.4"
},
"symfony/orm-pack": {
"version": "v2.1.0"
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-icu": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.22.1"
},
"symfony/polyfill-mbstring": {
"version": "v1.22.1"
},
"symfony/polyfill-php73": {
"version": "v1.22.1"
},
"symfony/polyfill-php80": {
"version": "v1.22.1"
},
"symfony/profiler-pack": {
"version": "v1.0.5"
},
"symfony/property-access": {
"version": "v5.2.4"
},
"symfony/property-info": {
"version": "v5.2.4"
},
"symfony/proxy-manager-bridge": {
"version": "v5.2.4"
},
"symfony/routing": { "symfony/routing": {
"version": "5.4", "version": "5.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.3", "version": "5.1",
"ref": "85de1d8ae45b284c3c84b668171d2615049e698f" "ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
}, },
"files": [ "files": [
"config/packages/prod/routing.yaml",
"config/packages/routing.yaml", "config/packages/routing.yaml",
"config/routes.yaml" "config/routes.yaml"
] ]
}, },
"symfony/translation": { "symfony/security-core": {
"version": "5.4", "version": "v5.2.6"
"recipe": { },
"repo": "github.com/symfony/recipes", "symfony/security-csrf": {
"branch": "main", "version": "v5.2.4"
"version": "5.3", },
"ref": "da64f5a2b6d96f5dc24914517c0350a5f91dee43" "symfony/service-contracts": {
}, "version": "v2.2.0"
"files": [ },
"config/packages/translation.yaml", "symfony/stopwatch": {
"translations/.gitignore" "version": "v5.2.4"
] },
"symfony/string": {
"version": "v5.2.6"
},
"symfony/translation-contracts": {
"version": "v2.3.0"
},
"symfony/twig-bridge": {
"version": "v5.2.6"
}, },
"symfony/twig-bundle": { "symfony/twig-bundle": {
"version": "5.4", "version": "5.0",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.4", "version": "5.0",
"ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387" "ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d"
}, },
"files": [ "files": [
"config/packages/test/twig.yaml",
"config/packages/twig.yaml", "config/packages/twig.yaml",
"templates/base.html.twig" "templates/base.html.twig"
] ]
}, },
"symfony/twig-pack": {
"version": "v1.0.1"
},
"symfony/validator": { "symfony/validator": {
"version": "5.4", "version": "4.3",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.3", "version": "4.3",
"ref": "c32cfd98f714894c4f128bb99aa2530c1227603c" "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
}, },
"files": [ "files": [
"config/packages/test/validator.yaml",
"config/packages/validator.yaml" "config/packages/validator.yaml"
] ]
}, },
"symfony/var-dumper": {
"version": "v5.2.6"
},
"symfony/var-exporter": {
"version": "v5.2.4"
},
"symfony/web-profiler-bundle": { "symfony/web-profiler-bundle": {
"version": "5.4", "version": "3.3",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "5.3", "version": "3.3",
"ref": "24bbc3d84ef2f427f82104f766014e799eefcc3e" "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6"
}, },
"files": [ "files": [
"config/packages/web_profiler.yaml", "config/packages/dev/web_profiler.yaml",
"config/routes/web_profiler.yaml" "config/packages/test/web_profiler.yaml",
"config/routes/dev/web_profiler.yaml"
] ]
}, },
"symfony/webpack-encore-bundle": { "symfony/webpack-encore-bundle": {
"version": "1.15", "version": "1.9",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "master",
"version": "1.10", "version": "1.9",
"ref": "eff2e505d4557c967b6710fe06bd947ba555cae5" "ref": "9399a0bfc6ee7a0c019f952bca46d6a6045dd451"
}, },
"files": [ "files": [
"assets/app.js", "assets/app.js",
@ -192,9 +375,21 @@
"assets/controllers.json", "assets/controllers.json",
"assets/controllers/hello_controller.js", "assets/controllers/hello_controller.js",
"assets/styles/app.css", "assets/styles/app.css",
"config/packages/assets.yaml",
"config/packages/prod/webpack_encore.yaml",
"config/packages/test/webpack_encore.yaml",
"config/packages/webpack_encore.yaml", "config/packages/webpack_encore.yaml",
"package.json", "package.json",
"webpack.config.js" "webpack.config.js"
] ]
},
"symfony/yaml": {
"version": "v5.2.5"
},
"twig/extra-bundle": {
"version": "v3.3.0"
},
"twig/twig": {
"version": "v3.3.0"
} }
} }

View File

@ -3,14 +3,14 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title> <title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>"> {# Run `composer require symfony/webpack-encore-bundle`
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} and uncomment the following Encore helpers to start using Symfony UX #}
{% block stylesheets %} {% block stylesheets %}
{{ encore_entry_link_tags('app') }} {#{{ encore_entry_link_tags('app') }}#}
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
{{ encore_entry_script_tags('app') }} {#{{ encore_entry_script_tags('app') }}#}
{% endblock %} {% endblock %}
</head> </head>
<body> <body>

View File

@ -11,7 +11,7 @@ Encore
.setOutputPath('public/build/') .setOutputPath('public/build/')
// public path used by the web server to access the output path // public path used by the web server to access the output path
.setPublicPath('/build') .setPublicPath('/build')
// only needed for CDN's or subdirectory deploy // only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/') //.setManifestKeyPrefix('build/')
/* /*
@ -45,19 +45,18 @@ Encore
// enables hashed filenames (e.g. app.abc123.css) // enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction()) .enableVersioning(Encore.isProduction())
// configure Babel .configureBabel((config) => {
// .configureBabel((config) => { config.plugins.push('@babel/plugin-proposal-class-properties');
// config.plugins.push('@babel/a-babel-plugin'); })
// })
// enables and configure @babel/preset-env polyfills // enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => { .configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage'; config.useBuiltIns = 'usage';
config.corejs = '3.23'; config.corejs = 3;
}) })
// enables Sass/SCSS support // enables Sass/SCSS support
//.enableSassLoader() .enableSassLoader()
// uncomment if you use TypeScript // uncomment if you use TypeScript
//.enableTypeScriptLoader() //.enableTypeScriptLoader()

File diff suppressed because it is too large Load Diff

0
data/.keep Normal file
View File

View File

@ -20,3 +20,4 @@ docker run --rm -it \
--workdir "/app" \ --workdir "/app" \
--env "YARN_CACHE_FOLDER=/app/.yarncache" \ --env "YARN_CACHE_FOLDER=/app/.yarncache" \
node:14 ${cmd} node:14 ${cmd}

View File

@ -57,7 +57,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
RUN curl -sS https://get.symfony.com/cli/installer -o /usr/local/bin/installer | bash \ RUN curl -sS https://get.symfony.com/cli/installer -o /usr/local/bin/installer | bash \
&& chmod a+x /usr/local/bin/installer \ && chmod a+x /usr/local/bin/installer \
&& /usr/local/bin/installer \ && /usr/local/bin/installer \
&& mv /root/.symfony5/bin/symfony /usr/local/bin/symfony \ && mv /root/.symfony/bin/symfony /usr/local/bin/symfony \
&& chmod a+x /usr/local/bin/symfony && chmod a+x /usr/local/bin/symfony
# Add users/groups with uid 1000 # Add users/groups with uid 1000