diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 025a76b..9dec7ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.2 coverage: none - name: Download dependencies diff --git a/.gitignore b/.gitignore index 6a7987a..7c04f2c 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,8 @@ npm-debug.log yarn-error.log ###< symfony/webpack-encore-bundle ### -composer.lock \ No newline at end of file +composer.lock +###> symfony/asset-mapper ### +/public/assets/ +/assets/vendor/ +###< symfony/asset-mapper ### diff --git a/composer.json b/composer.json index 5e82965..35650f4 100644 --- a/composer.json +++ b/composer.json @@ -2,59 +2,60 @@ "type": "project", "license": "proprietary", "require": { - "php": ">=7.1.3", + "php": ">=8.1", "ext-ctype": "*", "ext-iconv": "*", - "api-platform/core": "^2.6", "composer/package-versions-deprecated": "1.11.99.1", "doctrine/annotations": "^1.0", - "doctrine/doctrine-bundle": "^2.3", + "doctrine/doctrine-bundle": "^2.11", "doctrine/orm": "^2.8", "phpdocumentor/reflection-docblock": "^5.2", - "sensio/framework-extra-bundle": "^5.1", - "symfony/asset": "5.4.*", - "symfony/console": "5.4.*", - "symfony/dotenv": "5.4.*", - "symfony/expression-language": "5.4.*", + "symfony/asset": "*", + "symfony/asset-mapper": "*", + "symfony/console": "*", + "symfony/dotenv": "*", + "symfony/emoji": "7.1.*", + "symfony/expression-language": "*", "symfony/flex": "^1.3.1", - "symfony/form": "5.4.*", - "symfony/framework-bundle": "5.4.*", - "symfony/http-client": "5.4.*", - "symfony/intl": "5.4.*", - "symfony/lock": "5.4.*", - "symfony/mailer": "5.4.*", + "symfony/form": "*", + "symfony/framework-bundle": "*", + "symfony/html-sanitizer": "*", + "symfony/http-client": "*", + "symfony/intl": "*", + "symfony/lock": "*", + "symfony/mailer": "*", "symfony/mercure-bundle": "^0.3.2", - "symfony/messenger": "5.4.*", + "symfony/messenger": "*", "symfony/monolog-bundle": "^3.1", - "symfony/notifier": "5.4.*", - "symfony/process": "5.4.*", - "symfony/property-access": "5.4.*", - "symfony/property-info": "5.4.*", - "symfony/proxy-manager-bridge": "5.4.*", - "symfony/rate-limiter": "5.4.*", - "symfony/routing": "5.4.*", - "symfony/security-bundle": "5.4.*", - "symfony/serializer": "5.4.*", - "symfony/translation": "5.4.*", - "symfony/twig-bundle": "5.4.*", - "symfony/uid": "5.4.*", - "symfony/validator": "5.4.*", - "symfony/web-link": "5.4.*", - "symfony/webpack-encore-bundle": "^1.11", - "symfony/workflow": "5.4.*", - "symfony/yaml": "5.4.*", + "symfony/notifier": "*", + "symfony/process": "*", + "symfony/property-access": "*", + "symfony/property-info": "*", + "symfony/rate-limiter": "*", + "symfony/routing": "*", + "symfony/scheduler": "*", + "symfony/security-bundle": "*", + "symfony/serializer": "*", + "symfony/translation": "*", + "symfony/twig-bundle": "*", + "symfony/uid": "*", + "symfony/validator": "*", + "symfony/web-link": "*", + "symfony/webpack-encore-bundle": "^2.1", + "symfony/workflow": "*", + "symfony/yaml": "*", "twig/extra-bundle": "^3.0", "twig/twig": "^3.0" }, "require-dev": { - "symfony/browser-kit": "5.4.*", - "symfony/css-selector": "5.4.*", - "symfony/debug-bundle": "5.4.*", + "symfony/browser-kit": "*", + "symfony/css-selector": "*", + "symfony/debug-bundle": "*", "symfony/maker-bundle": "^1.0", "symfony/phpunit-bridge": "^5.2", - "symfony/stopwatch": "5.4.*", - "symfony/var-dumper": "5.4.*", - "symfony/web-profiler-bundle": "5.4.*" + "symfony/stopwatch": "*", + "symfony/var-dumper": "*", + "symfony/web-profiler-bundle": "*" }, "config": { "allow-plugins": { @@ -86,7 +87,8 @@ "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" + "assets:install %PUBLIC_DIR%": "symfony-cmd", + "importmap:install": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts" @@ -101,7 +103,7 @@ "extra": { "symfony": { "allow-contrib": false, - "require": "5.4.*" + "require": "7.2.*" } }, "minimum-stability": "dev", diff --git a/config/bundles.php b/config/bundles.php index 87a56e8..3154197 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,7 +2,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], @@ -13,5 +12,4 @@ Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ]; diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml deleted file mode 100644 index 2eb7b4c..0000000 --- a/config/packages/api_platform.yaml +++ /dev/null @@ -1,7 +0,0 @@ -api_platform: - mapping: - paths: ['%kernel.project_dir%/src/Entity'] - patch_formats: - json: ['application/merge-patch+json'] - swagger: - versions: [3] diff --git a/config/packages/asset_mapper.yaml b/config/packages/asset_mapper.yaml new file mode 100644 index 0000000..d1ac653 --- /dev/null +++ b/config/packages/asset_mapper.yaml @@ -0,0 +1,5 @@ +framework: + asset_mapper: + # The paths to make available to the asset mapper. + paths: + - assets/ diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 491dc6f..b9d0132 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -13,7 +13,7 @@ doctrine: mappings: App: is_bundle: false - type: annotation + type: attribute dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App diff --git a/config/packages/security.yaml b/config/packages/security.yaml new file mode 100644 index 0000000..058cbed --- /dev/null +++ b/config/packages/security.yaml @@ -0,0 +1,39 @@ +security: + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider + providers: + users_in_memory: { memory: null } + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + lazy: true + provider: users_in_memory + + # activate different ways to authenticate + # https://symfony.com/doc/current/security.html#the-firewall + + # https://symfony.com/doc/current/security/impersonating_user.html + # 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: + # - { path: ^/admin, roles: ROLE_ADMIN } + # - { path: ^/profile, roles: ROLE_USER } + +when@test: + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # 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: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/packages/sensio_framework_extra.yaml b/config/packages/sensio_framework_extra.yaml deleted file mode 100644 index 1821ccc..0000000 --- a/config/packages/sensio_framework_extra.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sensio_framework_extra: - router: - annotations: false diff --git a/config/routes.yaml b/config/routes.yaml index c3283aa..2d0ef99 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,5 @@ -#index: -# path: / -# controller: App\Controller\DefaultController::index +controllers: + resource: + path: ../src/Controller/ + namespace: App\Controller + type: attribute diff --git a/config/routes/annotations.yaml b/config/routes/annotations.yaml deleted file mode 100644 index e92efc5..0000000 --- a/config/routes/annotations.yaml +++ /dev/null @@ -1,7 +0,0 @@ -controllers: - resource: ../../src/Controller/ - type: annotation - -kernel: - resource: ../../src/Kernel.php - type: annotation diff --git a/config/routes/api_platform.yaml b/config/routes/api_platform.yaml deleted file mode 100644 index 38f11cb..0000000 --- a/config/routes/api_platform.yaml +++ /dev/null @@ -1,4 +0,0 @@ -api_platform: - resource: . - type: api_platform - prefix: /api diff --git a/importmap.php b/importmap.php new file mode 100644 index 0000000..70ebf14 --- /dev/null +++ b/importmap.php @@ -0,0 +1,19 @@ + [ + 'path' => './assets/app.js', + 'entrypoint' => true, + ], +]; diff --git a/src/Kernel.php b/src/Kernel.php index 1cd0572..b06fc79 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -3,52 +3,14 @@ namespace App; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\RouteCollectionBuilder; class Kernel extends BaseKernel { use MicroKernelTrait; - private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; - - public function registerBundles(): iterable - { - $contents = require $this->getProjectDir().'/config/bundles.php'; - foreach ($contents as $class => $envs) { - if ($envs[$this->environment] ?? $envs['all'] ?? false) { - yield new $class(); - } - } - } - public function getProjectDir(): string { return \dirname(__DIR__); } - - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void - { - $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); - $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); - $container->setParameter('container.dumper.inline_factories', true); - $confDir = $this->getProjectDir().'/config'; - - $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); - $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); - } - - protected function configureRoutes(RouteCollectionBuilder $routes): void - { - $confDir = $this->getProjectDir().'/config'; - - $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); - $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); - } } diff --git a/symfony.lock b/symfony.lock index e329072..41e798a 100644 --- a/symfony.lock +++ b/symfony.lock @@ -83,12 +83,6 @@ "fig/link-util": { "version": "1.2.0" }, - "friendsofphp/proxy-manager-lts": { - "version": "v1.0.5" - }, - "laminas/laminas-code": { - "version": "4.5.0" - }, "lcobucci/clock": { "version": "2.1.0" }, @@ -125,24 +119,27 @@ "psr/log": { "version": "2.0.0" }, - "sensio/framework-extra-bundle": { - "version": "5.6", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.2", - "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" - }, - "files": [ - "config/packages/sensio_framework_extra.yaml" - ] - }, "symfony/amqp-messenger": { "version": "v6.0.0" }, "symfony/asset": { "version": "v5.4.0" }, + "symfony/asset-mapper": { + "version": "7.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.4", + "ref": "6c28c471640cc2c6e60812ebcb961c526ef8997f" + }, + "files": [ + "assets/app.js", + "assets/styles/app.css", + "config/packages/asset_mapper.yaml", + "importmap.php" + ] + }, "symfony/browser-kit": { "version": "v5.4.0" }, @@ -349,7 +346,7 @@ ] }, "symfony/notifier": { - "version": "5.4", + "version": "6.0", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", @@ -405,9 +402,6 @@ "symfony/polyfill-php80": { "version": "v1.23.1" }, - "symfony/polyfill-php81": { - "version": "v1.23.0" - }, "symfony/polyfill-uuid": { "version": "v1.23.0" }, @@ -420,11 +414,8 @@ "symfony/property-info": { "version": "v5.4.0" }, - "symfony/proxy-manager-bridge": { - "version": "v5.4.0" - }, "symfony/rate-limiter": { - "version": "v5.4.0" + "version": "v6.0.0" }, "symfony/redis-messenger": { "version": "v6.0.0" @@ -511,7 +502,7 @@ ] }, "symfony/uid": { - "version": "v5.4.0" + "version": "v6.0.0" }, "symfony/validator": { "version": "5.4", @@ -549,6 +540,18 @@ "config/routes/dev/web_profiler.yaml" ] }, + "symfony/webhook": { + "version": "6.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.3", + "ref": "0bc853a74c98e448116ba53e118a7b6b3cdf9a03" + }, + "files": [ + "config/routes/webhook.yaml" + ] + }, "symfony/webpack-encore-bundle": { "version": "1.13", "recipe": { diff --git a/templates/base.html.twig b/templates/base.html.twig index 16d7273..eb686a8 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -10,6 +10,7 @@ {% endblock %} {% block javascripts %} + {% block importmap %}{{ importmap('app') }}{% endblock %} {#{{ encore_entry_script_tags('app') }}#} {% endblock %}