From 9318fd87703446e4959999dd33bce9256cda7178 Mon Sep 17 00:00:00 2001 From: Deuchnord Date: Fri, 13 Sep 2024 15:08:42 +0200 Subject: [PATCH] feat(SMS): add support for Brevo provider (#735) --- .env | 5 +++ composer.json | 1 + composer.lock | 72 ++++++++++++++++++++++++++++++++++++++++++- docs/configuration.md | 18 ++++++----- symfony.lock | 9 ++++++ 5 files changed, 97 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 8597c75..daf980d 100644 --- a/.env +++ b/.env @@ -74,6 +74,7 @@ MAILER_DSN=null://null # This is main the DNS that is used by the notifier component # the other below are just example for two different third party vendors #SMS_DSN=twilio://SID:TOKEN@default?from=FROM +#SMS_DSN=brevo://API_KEY@default?sender=SENDER SMS_DSN=null://null ###< symfony/notifier ### @@ -106,3 +107,7 @@ STORAGE_USE_PATH_STYLE_ENDPOINT=true STORAGE_KEY=app STORAGE_SECRET=!ChangeMe! ###< league/flysystem-bundle ### + +###> symfony/brevo-notifier ### +# BREVO_DSN=brevo://API_KEY@default?sender=SENDER +###< symfony/brevo-notifier ### diff --git a/composer.json b/composer.json index 2c5c672..3b87a6d 100644 --- a/composer.json +++ b/composer.json @@ -51,6 +51,7 @@ "snc/redis-bundle": "^4.3", "stof/doctrine-extensions-bundle": "^1.7", "symfony/asset": "6.4.*", + "symfony/brevo-notifier": "6.4.*", "symfony/cache": "6.4.*", "symfony/clock": "6.4.*", "symfony/console": "6.4.*", diff --git a/composer.lock b/composer.lock index 626de96..46ba6c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "66ed0749f68e437c6d15a770e30ee54f", + "content-hash": "f923f481246dcd1703ff8df8ada5ccc3", "packages": [ { "name": "alcohol/iso4217", @@ -8792,6 +8792,76 @@ ], "time": "2024-05-31T14:49:08+00:00" }, + { + "name": "symfony/brevo-notifier", + "version": "v6.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/brevo-notifier.git", + "reference": "6c5ccdabaea84d8f88517960563ffdba78c83925" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/brevo-notifier/zipball/6c5ccdabaea84d8f88517960563ffdba78c83925", + "reference": "6c5ccdabaea84d8f88517960563ffdba78c83925", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/notifier": "^6.4|^7.0" + }, + "require-dev": { + "symfony/event-dispatcher": "^5.4|^6.0|^7.0" + }, + "type": "symfony-notifier-bridge", + "autoload": { + "psr-4": { + "Symfony\\Component\\Notifier\\Bridge\\Brevo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pierre Tanguy", + "homepage": "https://github.com/petanguy" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Brevo Notifier Bridge", + "homepage": "https://symfony.com", + "keywords": [ + "brevo", + "notifier" + ], + "support": { + "source": "https://github.com/symfony/brevo-notifier/tree/v6.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:51:39+00:00" + }, { "name": "symfony/cache", "version": "v6.4.11", diff --git a/docs/configuration.md b/docs/configuration.md index 6459fcb..d658b06 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -4,7 +4,6 @@ This page documents the settings that can be configured as environment varibles for the production environment. Defaults value are shown in the [.env](../.env) file. - ## Application | name | default value | @@ -47,7 +46,7 @@ For example, to use a standart SMTP server use: Where mailer is the DSN of your SMTP server and 1025 the port to use. -Yo use Gmail with a secret key use: +To use Gmail with a secret key use: MAILER_DSN=gmail://email@example.com:secretkey@default @@ -58,14 +57,19 @@ Twilio, Sendgrid, Mailingblue... SMS_DSN=null://null -This is the main parameter to send DNS. If you leave `null://null`, nothing will -be send without errors. It can be useful when having issues with your SMS provider -and wanting to disable it temporarly. +This is the main parameter to send DNS. If you leave `null://null`, no SMS will +be sent. +It may be useful when having issues with your SMS provider and wanting to disable it temporarily. -For example, to use a service like Twilio, the parameters should look like: +Below are the supported value templates to use depending on your SMS provider. - SMS_DSN=twilio://AccountSID:AuthToken@default?from=%2BFROMNUMBER +### Brevo + SMS_DSN=brevo://API_KEY@default?sender=PHONE_NUMBER + +### Twilio + + SMS_DSN=twilio://AccountSID:AuthToken@default?from=PHONE_NUMBER ## Meilisearch diff --git a/symfony.lock b/symfony.lock index 2ce8bde..1072167 100644 --- a/symfony.lock +++ b/symfony.lock @@ -232,6 +232,15 @@ "config/packages/stof_doctrine_extensions.yaml" ] }, + "symfony/brevo-notifier": { + "version": "6.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.4", + "ref": "3ae8f4671b4c42babcf3c1ce306a85c6398474a5" + } + }, "symfony/console": { "version": "6.1", "recipe": {