Skip to content

Commit 906ebbc

Browse files
vince83110Vincent DECAUX
andauthored
Add Symfony 8 support, use Yaml Loader instead of deprecated XmlFileLoader (#57)
* Update composer.json to support Symfony 8.0 * Chore: Add Symfony 8 support, use Yaml loader instead of Xml * Chore: update documentation to use yaml instead of xml --------- Co-authored-by: Vincent DECAUX <vincent.d@obat.fr>
1 parent b53c8cf commit 906ebbc

7 files changed

Lines changed: 47 additions & 62 deletions

File tree

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
"ext-openssl": "*",
1818
"guzzlehttp/guzzle": "^6.5.8 || ^7.4",
1919
"minishlink/web-push": "^6.0.7 || ^7.0 || ^8.0 || ^9.0",
20-
"symfony/http-kernel": "^5.4.20 || ^6.0 || ^7.0"
20+
"symfony/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.0",
21+
"symfony/http-kernel": "^5.4.20 || ^6.0 || ^7.0 || ^8.0"
2122
},
2223
"require-dev": {
2324
"bentools/doctrine-static": "1.0.x-dev",
2425
"doctrine/dbal": "^2.9 || ^3.0",
2526
"phpunit/phpunit": "^9.0",
26-
"symfony/config": "^5.4 || ^6.0 || ^7.0",
27-
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
28-
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
29-
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
30-
"symfony/routing": "^5.4 || ^6.0 || ^7.0",
31-
"symfony/security-core": "^5.4 || ^6.0 || ^7.0",
32-
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
33-
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
27+
"symfony/config": "^5.4 || ^6.0 || ^7.0 || ^8.0",
28+
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0 || ^8.0",
29+
"symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0 || ^8.0",
30+
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0 || ^8.0",
31+
"symfony/routing": "^5.4 || ^6.0 || ^7.0 || ^8.0",
32+
"symfony/security-core": "^5.4 || ^6.0 || ^7.0 || ^8.0",
33+
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0 || ^8.0",
3434
"twig/twig": "^2.0 || ^3.0"
3535
},
3636
"autoload": {

doc/03 - Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Note that Apple requires the subject to be an URL or a mailto URL.
2222
# app/config/routing.yml (SF3)
2323
# config/routing.yaml (SF4)
2424
bentools_webpush:
25-
resource: '@WebPushBundle/Resources/config/routing.xml'
25+
resource: '@WebPushBundle/Resources/config/routing.yaml'
2626
prefix: /webpush
2727
```
2828

src/DependencyInjection/WebPushExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\Config\FileLocator;
66
use Symfony\Component\DependencyInjection\ContainerBuilder;
7-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
7+
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
88
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
99

1010
/**
@@ -25,8 +25,8 @@ public function load(array $configs, ContainerBuilder $container): void
2525
$container->setParameter('bentools_webpush.vapid_subject', $config['settings']['subject'] ?? $container->getParameter('router.request_context.host'));
2626
$container->setParameter('bentools_webpush.vapid_public_key', $config['settings']['public_key'] ?? null);
2727
$container->setParameter('bentools_webpush.vapid_private_key', $config['settings']['private_key'] ?? null);
28-
$loader = new XmlFileLoader($container, new FileLocator([__DIR__.'/../Resources/config/']));
29-
$loader->load('services.xml');
28+
$loader = new YamlFileLoader($container, new FileLocator([__DIR__.'/../Resources/config/']));
29+
$loader->load('services.yaml');
3030
}
3131

3232
/**

src/Resources/config/routing.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Resources/config/routing.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bentools_webpush.subscription:
2+
path: /
3+
methods: [POST, DELETE]
4+
defaults:
5+
_controller: BenTools\WebPushBundle\Action\RegisterSubscriptionAction

src/Resources/config/services.xml

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Resources/config/services.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
BenTools\WebPushBundle\Command\WebPushGenerateKeysCommand:
3+
tags:
4+
- { name: console.command }
5+
6+
BenTools\WebPushBundle\Twig\WebPushTwigExtension:
7+
arguments:
8+
- '%bentools_webpush.vapid_public_key%'
9+
tags:
10+
- { name: twig.extension }
11+
12+
BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry: ~
13+
14+
BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerInterface:
15+
alias: BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry
16+
17+
BenTools\WebPushBundle\Action\RegisterSubscriptionAction:
18+
public: true
19+
arguments:
20+
- '@BenTools\WebPushBundle\Model\Subscription\UserSubscriptionManagerRegistry'
21+
tags:
22+
- { name: controller.service_arguments }
23+
24+
BenTools\WebPushBundle\Sender\PushMessageSender:
25+
arguments:
26+
- VAPID:
27+
subject: '%bentools_webpush.vapid_subject%'
28+
publicKey: '%bentools_webpush.vapid_public_key%'
29+
privateKey: '%bentools_webpush.vapid_private_key%'

0 commit comments

Comments
 (0)