Skip to content

Commit 69a5692

Browse files
Merge branch 'main' into ft-sf-ux-stimulus-demo
2 parents 34a981f + 3b6c3f3 commit 69a5692

File tree

111 files changed

+4991
-5845
lines changed

Some content is hidden

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

111 files changed

+4991
-5845
lines changed

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
3+
"features": {
4+
"ghcr.io/shyim/devcontainers-features/symfony-cli:0": {},
5+
"ghcr.io/shyim/devcontainers-features/php:0": {
6+
"version": "8.1"
7+
},
8+
"ghcr.io/devcontainers/features/node:1": {
9+
"version": "lts"
10+
}
11+
},
12+
"updateContentCommand": {
13+
"composer install": ["composer", "install"],
14+
"yarn": ["yarn"]
15+
},
16+
"postAttachCommand": {
17+
"server": "symfony server:start",
18+
"yarn": ["yarn", "watch"]
19+
}
20+
}

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Real environment variables win over .env files.
1010
#
1111
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
1213
#
1314
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
1415
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
@@ -30,5 +31,5 @@ DATABASE_URL=sqlite:///%kernel.project_dir%/data/database.sqlite
3031
###< doctrine/doctrine-bundle ###
3132

3233
###> symfony/mailer ###
33-
# MAILER_DSN=smtp://localhost
34+
# MAILER_DSN=null://null
3435
###< symfony/mailer ###

.github/workflows/lint.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ on:
99
env:
1010
fail-fast: true
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
php-cs-fixer:
1417
name: PHP-CS-Fixer
1518
runs-on: ubuntu-latest
1619
steps:
1720
- name: "Checkout code"
18-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
1922

2023
- name: PHP-CS-Fixer
2124
uses: docker://oskarstark/php-cs-fixer-ga
@@ -27,14 +30,14 @@ jobs:
2730
runs-on: ubuntu-latest
2831
strategy:
2932
matrix:
30-
php-version: ['8.0']
33+
php-version: ['8.1']
3134

3235
steps:
3336
- name: "Checkout code"
34-
uses: actions/checkout@v2.3.3
37+
uses: actions/checkout@v3
3538

3639
- name: "Install PHP with extensions"
37-
uses: shivammathur/setup-php@2.7.0
40+
uses: shivammathur/setup-php@v2
3841
with:
3942
coverage: "none"
4043
extensions: intl
@@ -43,10 +46,10 @@ jobs:
4346

4447
- name: "Set composer cache directory"
4548
id: composer-cache
46-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
49+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4750

4851
- name: "Cache composer"
49-
uses: actions/cache@v2.1.2
52+
uses: actions/cache@v3
5053
with:
5154
path: ${{ steps.composer-cache.outputs.dir }}
5255
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}
@@ -83,13 +86,9 @@ jobs:
8386
if: always() && steps.install.outcome == 'success'
8487
run: composer validate --strict
8588

86-
- name: Download Symfony CLI
87-
if: always() && steps.install.outcome == 'success'
88-
run: wget https://get.symfony.com/cli/installer -O - | bash
89-
9089
- name: Check if any dependencies are compromised
9190
if: always() && steps.install.outcome == 'success'
92-
run: /home/runner/.symfony/bin/symfony check:security
91+
run: composer audit
9392

9493
- name: Run PHPStan
9594
if: always() && steps.install.outcome == 'success'

.github/workflows/tests.yaml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ env:
1010
fail-fast: true
1111
PHPUNIT_FLAGS: "-v"
1212
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
13-
SYMFONY_REQUIRE: ">=4.4"
14-
# 40x: Since symfony/monolog-bridge 5.2:
15-
# Passing an actionLevel (int|string) as constructor's 3rd argument of
16-
# "Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy"
17-
# is deprecated, "Monolog\Handler\FingersCrossed\ActivationStrategyInterface" expected.
18-
SYMFONY_DEPRECATIONS_HELPER: 40
13+
SYMFONY_DEPRECATIONS_HELPER: 7
14+
15+
permissions:
16+
contents: read
1917

2018
jobs:
2119
test:
@@ -25,15 +23,20 @@ jobs:
2523

2624
strategy:
2725
matrix:
28-
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
29-
php-version: ['8.0']
26+
operating-system: ['ubuntu-latest']
27+
php-version: ['8.1']
28+
include:
29+
- operating-system: 'macos-latest'
30+
php-version: '8.1'
31+
- operating-system: 'windows-latest'
32+
php-version: '8.1'
3033

3134
steps:
3235
- name: "Checkout code"
33-
uses: actions/checkout@v2.3.3
36+
uses: actions/checkout@v3
3437

3538
- name: "Install PHP with extensions"
36-
uses: shivammathur/setup-php@2.7.0
39+
uses: shivammathur/setup-php@v2
3740
with:
3841
coverage: "none"
3942
extensions: "intl, mbstring, pdo_sqlite"
@@ -45,19 +48,18 @@ jobs:
4548

4649
- name: "Set composer cache directory"
4750
id: composer-cache
48-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
51+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
52+
shell: bash
4953

5054
- name: "Cache composer"
51-
uses: actions/cache@v2.1.2
55+
uses: actions/cache@v3
5256
with:
5357
path: ${{ steps.composer-cache.outputs.dir }}
5458
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}
5559
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-
5660

57-
- name: "Require symfony/flex"
58-
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
59-
60-
- run: composer update
61+
- name: "Install dependencies"
62+
run: composer install --no-interaction --no-progress
6163

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

.php-cs-fixer.dist.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
'phpdoc_order' => true,
3737
'strict_comparison' => true,
3838
'strict_param' => true,
39+
'blank_line_between_import_groups' => false,
3940
])
4041
->setFinder($finder)
41-
->setCacheFile(__DIR__.'/var/.php_cs.cache')
42+
->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache')
4243
;

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-2020 Fabien Potencier
1+
Copyright (c) 2015-2022 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ Symfony Demo Application
44
The "Symfony Demo Application" is a reference application created to show how
55
to develop applications following the [Symfony Best Practices][1].
66

7+
You can also learn about these practices in [the official Symfony Book][5].
8+
79
Requirements
810
------------
911

10-
* PHP 7.3 or higher;
12+
* PHP 8.1.0 or higher;
1113
* PDO-SQLite PHP extension enabled;
1214
* and the [usual Symfony application requirements][2].
1315

@@ -27,6 +29,13 @@ Alternatively, you can use Composer:
2729
$ composer create-project symfony/symfony-demo my_project
2830
```
2931

32+
If you want to test the demo without installing anything locally, you can also
33+
deploy it on Platform.sh, the official Symfony PaaS:
34+
35+
<p align="center">
36+
<a href="https://console.platform.sh/projects/create-project?template=https://raw.githubusercontent.com/symfonycorp/platformsh-symfony-template-metadata/main/template-metadata-demo.yaml&utm_content=symfonycorp&utm_source=github&utm_medium=button&utm_campaign=deploy_on_platform"><img src="https://platform.sh/images/deploy/lg-blue.svg" alt="Deploy on Platform.sh" width="180px" /></a>
37+
</p>
38+
3039
Usage
3140
-----
3241

@@ -55,6 +64,7 @@ $ ./bin/phpunit
5564
```
5665

5766
[1]: https://symfony.com/doc/current/best_practices.html
58-
[2]: https://symfony.com/doc/current/reference/requirements.html
59-
[3]: https://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
67+
[2]: https://symfony.com/doc/current/setup.html#technical-requirements
68+
[3]: https://symfony.com/doc/current/setup/web_server_configuration.html
6069
[4]: https://symfony.com/download
70+
[5]: https://symfony.com/book

assets/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
44
export const app = startStimulusApp(require.context(
55
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
66
true,
7-
/\.(j|t)sx?$/
7+
/\.[jt]sx?$/
88
));
99

1010
// register any custom, 3rd party controllers here

assets/js/doclinks.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,37 @@ $(function() {
1010
return '<a class="doclink" target="_blank" href="' + url + '">' + content + '</a>';
1111
};
1212

13+
function wrap(content, links) {
14+
return content.replace(
15+
new RegExp(Object.keys(links).join('|'), 'g'),
16+
token => anchor(links[token], token)
17+
);
18+
};
19+
1320
// Wraps links to the Symfony documentation
1421
$modal.find('.hljs-comment').each(function() {
1522
$(this).html($(this).html().replace(/https:\/\/symfony.com\/doc\/[\w/.#-]+/g, function(url) {
1623
return anchor(url, url);
1724
}));
1825
});
1926

20-
// Wraps Symfony's annotations
21-
var annotations = {
22-
'@Cache': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/cache.html',
23-
'@IsGranted': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#isgranted',
24-
'@ParamConverter': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html',
25-
'@Route': 'https://symfony.com/doc/current/routing.html#creating-routes-as-annotations',
26-
'@Security': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#security'
27+
// Wraps Symfony's attributes
28+
var attributes = {
29+
'Cache': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/cache.html',
30+
'IsGranted': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#isgranted',
31+
'ParamConverter': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html',
32+
'Route': 'https://symfony.com/doc/current/routing.html#creating-routes-as-attributes-or-annotations',
33+
'Security': 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#security'
2734
};
2835

29-
$controllerCode.find('.hljs-doctag').each(function() {
30-
var annotation = $(this).text();
36+
$controllerCode.find('.hljs-meta').each(function() {
37+
var src = $(this).text();
3138

32-
if (annotations[annotation]) {
33-
$(this).html(anchor(annotations[annotation], annotation));
34-
}
39+
$(this).html(wrap(src, attributes));
3540
});
3641

3742
// Wraps Twig's tags
38-
$templateCode.find('.hljs-template-tag > .hljs-name').each(function() {
43+
$templateCode.find('.hljs-template-tag + .hljs-name').each(function() {
3944
var tag = $(this).text();
4045

4146
if ('else' === tag || tag.match(/^end/)) {

assets/js/highlight.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import twig from 'highlight.js/lib/languages/twig';
55
hljs.registerLanguage('php', php);
66
hljs.registerLanguage('twig', twig);
77

8-
hljs.initHighlightingOnLoad();
8+
hljs.highlightAll();

assets/styles/app.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $lato-font-path: '~lato-font/fonts';
1212
@import "~bootswatch/flatly/bootswatch";
1313
@import "~@fortawesome/fontawesome-free/css/all.css";
1414
@import "~@fortawesome/fontawesome-free/css/v4-shims.css";
15-
@import "~highlight.js/styles/solarized-light.css";
15+
@import "~highlight.js/styles/github-dark-dimmed.css";
1616

1717
// pick the Lato fonts individually to avoid importing the entire font family
1818
@import '~lato-font/scss/public-api';
@@ -56,6 +56,14 @@ i {
5656
------------------------------------------------------------------------- */
5757
.m-b-0 { margin-bottom: 0 }
5858

59+
@media (min-width: $screen-md-min) {
60+
.modal-xl { width: $modal-lg; }
61+
}
62+
63+
@media (min-width: $screen-lg-min) {
64+
.modal-xl { width: $screen-lg-min - 60px; }
65+
}
66+
5967
/* Page elements
6068
------------------------------------------------------------------------- */
6169
body {

0 commit comments

Comments
 (0)