From 4b194068098deac70fd0286e183ba158c024820a Mon Sep 17 00:00:00 2001 From: Vincent DECAIX Date: Mon, 23 Mar 2026 12:38:18 +0100 Subject: [PATCH 1/3] Update composer.json to support Symfony 8.0 --- composer.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 8e4c2ca..e4958f6 100644 --- a/composer.json +++ b/composer.json @@ -17,20 +17,20 @@ "ext-openssl": "*", "guzzlehttp/guzzle": "^6.5.8 || ^7.4", "minishlink/web-push": "^6.0.7 || ^7.0 || ^8.0 || ^9.0", - "symfony/http-kernel": "^5.4.20 || ^6.0 || ^7.0" + "symfony/http-kernel": "^5.4.20 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { "bentools/doctrine-static": "1.0.x-dev", "doctrine/dbal": "^2.9 || ^3.0", "phpunit/phpunit": "^9.0", - "symfony/config": "^5.4 || ^6.0 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", - "symfony/routing": "^5.4 || ^6.0 || ^7.0", - "symfony/security-core": "^5.4 || ^6.0 || ^7.0", - "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/routing": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/security-core": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0", "twig/twig": "^2.0 || ^3.0" }, "autoload": { From 0ff771d979dd8632e16ae462cb929866735c4175 Mon Sep 17 00:00:00 2001 From: Vincent DECAUX Date: Mon, 23 Mar 2026 12:53:38 +0100 Subject: [PATCH 2/3] Chore: Add Symfony 8 support, use Yaml loader instead of Xml --- composer.json | 2 +- src/DependencyInjection/WebPushExtension.php | 6 ++-- src/Resources/config/routing.xml | 11 ------ src/Resources/config/routing.yaml | 5 +++ src/Resources/config/services.xml | 38 -------------------- src/Resources/config/services.yaml | 29 +++++++++++++++ 6 files changed, 38 insertions(+), 53 deletions(-) delete mode 100644 src/Resources/config/routing.xml create mode 100644 src/Resources/config/routing.yaml delete mode 100644 src/Resources/config/services.xml create mode 100644 src/Resources/config/services.yaml diff --git a/composer.json b/composer.json index e4958f6..151a918 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "ext-openssl": "*", "guzzlehttp/guzzle": "^6.5.8 || ^7.4", "minishlink/web-push": "^6.0.7 || ^7.0 || ^8.0 || ^9.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0", "symfony/http-kernel": "^5.4.20 || ^6.0 || ^7.0 || ^8.0" }, "require-dev": { @@ -30,7 +31,6 @@ "symfony/routing": "^5.4 || ^6.0 || ^7.0 || ^8.0", "symfony/security-core": "^5.4 || ^6.0 || ^7.0 || ^8.0", "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0 || ^8.0", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0", "twig/twig": "^2.0 || ^3.0" }, "autoload": { diff --git a/src/DependencyInjection/WebPushExtension.php b/src/DependencyInjection/WebPushExtension.php index 7d6c651..c08ed02 100644 --- a/src/DependencyInjection/WebPushExtension.php +++ b/src/DependencyInjection/WebPushExtension.php @@ -4,7 +4,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** @@ -25,8 +25,8 @@ public function load(array $configs, ContainerBuilder $container): void $container->setParameter('bentools_webpush.vapid_subject', $config['settings']['subject'] ?? $container->getParameter('router.request_context.host')); $container->setParameter('bentools_webpush.vapid_public_key', $config['settings']['public_key'] ?? null); $container->setParameter('bentools_webpush.vapid_private_key', $config['settings']['private_key'] ?? null); - $loader = new XmlFileLoader($container, new FileLocator([__DIR__.'/../Resources/config/'])); - $loader->load('services.xml'); + $loader = new YamlFileLoader($container, new FileLocator([__DIR__.'/../Resources/config/'])); + $loader->load('services.yaml'); } /** diff --git a/src/Resources/config/routing.xml b/src/Resources/config/routing.xml deleted file mode 100644 index 171c432..0000000 --- a/src/Resources/config/routing.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - BenTools\WebPushBundle\Action\RegisterSubscriptionAction - - - diff --git a/src/Resources/config/routing.yaml b/src/Resources/config/routing.yaml new file mode 100644 index 0000000..356230f --- /dev/null +++ b/src/Resources/config/routing.yaml @@ -0,0 +1,5 @@ +bentools_webpush.subscription: + path: / + methods: [POST, DELETE] + defaults: + _controller: BenTools\WebPushBundle\Action\RegisterSubscriptionAction \ No newline at end of file diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml deleted file mode 100644 index 1cc7fec..0000000 --- a/src/Resources/config/services.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - %bentools_webpush.vapid_public_key% - - - - - - - - - - - - - - - %bentools_webpush.vapid_subject% - %bentools_webpush.vapid_public_key% - %bentools_webpush.vapid_private_key% - - - - - - - diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml new file mode 100644 index 0000000..1b5eebe --- /dev/null +++ b/src/Resources/config/services.yaml @@ -0,0 +1,29 @@ +services: + BenTools\WebPushBundle\Command\WebPushGenerateKeysCommand: + tags: + - { name: console.command } + + BenTools\WebPushBundle\Twig\WebPushTwigExtension: + arguments: + - '%bentools_webpush.vapid_public_key%' + tags: + - { name: twig.extension } + + BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry: ~ + + BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerInterface: + alias: BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry + + BenTools\WebPushBundle\Action\RegisterSubscriptionAction: + public: true + arguments: + - '@BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry' + tags: + - { name: controller.service_arguments } + + BenTools\WebPushBundle\Sender\PushMessageSender: + arguments: + - VAPID: + subject: '%bentools_webpush.vapid_subject%' + publicKey: '%bentools_webpush.vapid_public_key%' + privateKey: '%bentools_webpush.vapid_private_key%' \ No newline at end of file From aebd518814237cbdb55973abc11522f549b6a4ed Mon Sep 17 00:00:00 2001 From: Vincent DECAUX Date: Mon, 23 Mar 2026 13:02:29 +0100 Subject: [PATCH 3/3] Chore: update documentation to use yaml instead of xml --- doc/03 - Configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/03 - Configuration.md b/doc/03 - Configuration.md index e6fbf70..b542a89 100644 --- a/doc/03 - Configuration.md +++ b/doc/03 - Configuration.md @@ -22,7 +22,7 @@ Note that Apple requires the subject to be an URL or a mailto URL. # app/config/routing.yml (SF3) # config/routing.yaml (SF4) bentools_webpush: - resource: '@WebPushBundle/Resources/config/routing.xml' + resource: '@WebPushBundle/Resources/config/routing.yaml' prefix: /webpush ```