+ *
+ * @experimental in 5.1
+ */
+final class MattermostTransportFactory extends AbstractTransportFactory
+{
+ public function create(Dsn $dsn): TransportInterface
+ {
+ $scheme = $dsn->getScheme();
+ $token = $this->getUser($dsn);
+ $channel = $dsn->getOption('channel');
+ $host = $dsn->getHost();
+ $port = $dsn->getPort();
+
+ if ('mattermost' === $scheme) {
+ return (new MattermostTransport($token, $channel, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
+ }
+
+ throw new UnsupportedSchemeException($dsn, 'mattermost', $this->getSupportedSchemes());
+ }
+
+ protected function getSupportedSchemes(): array
+ {
+ return ['mattermost'];
+ }
+}
diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/README.md b/src/Symfony/Component/Notifier/Bridge/Mattermost/README.md
new file mode 100644
index 0000000000000..0ed0fc00a7e54
--- /dev/null
+++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/README.md
@@ -0,0 +1,12 @@
+Mattermost Notifier
+===================
+
+Provides Mattermost integration for Symfony Notifier.
+
+Resources
+---------
+
+ * [Contributing](https://symfony.com/doc/current/contributing/index.html)
+ * [Report issues](https://github.com/symfony/symfony/issues) and
+ [send Pull Requests](https://github.com/symfony/symfony/pulls)
+ in the [main Symfony repository](https://github.com/symfony/symfony)
diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json b/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json
new file mode 100644
index 0000000000000..932033c30379f
--- /dev/null
+++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/composer.json
@@ -0,0 +1,35 @@
+{
+ "name": "symfony/mattermost-notifier",
+ "type": "symfony-bridge",
+ "description": "Symfony Mattermost Notifier Bridge",
+ "keywords": ["mattermost", "notifier"],
+ "homepage": "https://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Emanuele Panzeri",
+ "email": "thepanz@gmail.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": "^7.2.5",
+ "symfony/http-client": "^4.3|^5.0",
+ "symfony/notifier": "^5.0"
+ },
+ "autoload": {
+ "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Mattermost\\": "" },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.1-dev"
+ }
+ }
+}
diff --git a/src/Symfony/Component/Notifier/Bridge/Mattermost/phpunit.xml.dist b/src/Symfony/Component/Notifier/Bridge/Mattermost/phpunit.xml.dist
new file mode 100644
index 0000000000000..c7f35828124f0
--- /dev/null
+++ b/src/Symfony/Component/Notifier/Bridge/Mattermost/phpunit.xml.dist
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ ./Tests/
+
+
+
+
+
+ ./
+
+ ./Resources
+ ./Tests
+ ./vendor
+
+
+
+
diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/SlackTransport.php b/src/Symfony/Component/Notifier/Bridge/Slack/SlackTransport.php
index 566ee7a25f608..fb18f7c913769 100644
--- a/src/Symfony/Component/Notifier/Bridge/Slack/SlackTransport.php
+++ b/src/Symfony/Component/Notifier/Bridge/Slack/SlackTransport.php
@@ -33,10 +33,10 @@ final class SlackTransport extends AbstractTransport
private $accessToken;
private $chatChannel;
- public function __construct(string $accessToken, string $chatChannel = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
+ public function __construct(string $accessToken, string $channel = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
{
$this->accessToken = $accessToken;
- $this->chatChannel = $chatChannel;
+ $this->chatChannel = $channel;
$this->client = $client;
parent::__construct($client, $dispatcher);
diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php b/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php
index 7856938187499..4f9cb3b374d1c 100644
--- a/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php
+++ b/src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php
@@ -38,10 +38,10 @@ final class TelegramTransport extends AbstractTransport
private $token;
private $chatChannel;
- public function __construct(string $token, string $chatChannel = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
+ public function __construct(string $token, string $channel = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
{
$this->token = $token;
- $this->chatChannel = $chatChannel;
+ $this->chatChannel = $channel;
$this->client = $client;
parent::__construct($client, $dispatcher);
diff --git a/src/Symfony/Component/Notifier/CHANGELOG.md b/src/Symfony/Component/Notifier/CHANGELOG.md
index ce86089d2f0ba..1501819392785 100644
--- a/src/Symfony/Component/Notifier/CHANGELOG.md
+++ b/src/Symfony/Component/Notifier/CHANGELOG.md
@@ -4,6 +4,7 @@ CHANGELOG
5.1.0
-----
+ * Added the Mattermost notifier bridge
* [BC BREAK] The `ChatMessage::fromNotification()` method's `$recipient` and `$transport`
arguments were removed.
* [BC BREAK] The `EmailMessage::fromNotification()` and `SmsMessage::fromNotification()`
diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php
index c61446339ae5c..24bdebeb17c80 100644
--- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php
+++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php
@@ -30,6 +30,10 @@ class UnsupportedSchemeException extends LogicException
'class' => Bridge\Telegram\TelegramTransportFactory::class,
'package' => 'symfony/telegram-notifier',
],
+ 'mattermost' => [
+ 'class' => Bridge\Mattermost\MattermostTransportFactory::class,
+ 'package' => 'symfony/mattermost-notifier',
+ ],
'nexmo' => [
'class' => Bridge\Nexmo\NexmoTransportFactory::class,
'package' => 'symfony/nexmo-notifier',
diff --git a/src/Symfony/Component/Notifier/Transport.php b/src/Symfony/Component/Notifier/Transport.php
index c8e6a8ad3949c..1671fca2c964a 100644
--- a/src/Symfony/Component/Notifier/Transport.php
+++ b/src/Symfony/Component/Notifier/Transport.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Notifier;
+use Symfony\Component\Notifier\Bridge\Mattermost\MattermostTransportFactory;
use Symfony\Component\Notifier\Bridge\Nexmo\NexmoTransportFactory;
use Symfony\Component\Notifier\Bridge\Slack\SlackTransportFactory;
use Symfony\Component\Notifier\Bridge\Telegram\TelegramTransportFactory;
@@ -36,6 +37,7 @@ class Transport
private const FACTORY_CLASSES = [
SlackTransportFactory::class,
TelegramTransportFactory::class,
+ MattermostTransportFactory::class,
NexmoTransportFactory::class,
TwilioTransportFactory::class,
];
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy