diff --git a/composer.json b/composer.json
index 8e4c2ca..151a918 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/yaml": "^5.4 || ^6.0 || ^7.0 || ^8.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",
"twig/twig": "^2.0 || ^3.0"
},
"autoload": {
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
```
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