feat(SMS): add support for Brevo provider (#735)

This commit is contained in:
Deuchnord 2024-09-13 15:08:42 +02:00 committed by Hugo Nicolas
parent 32d91e49a0
commit 9318fd8770
No known key found for this signature in database
GPG key ID: 09CB3D93EB8B0E61
5 changed files with 97 additions and 8 deletions

5
.env
View file

@ -74,6 +74,7 @@ MAILER_DSN=null://null
# This is main the DNS that is used by the notifier component # This is main the DNS that is used by the notifier component
# the other below are just example for two different third party vendors # the other below are just example for two different third party vendors
#SMS_DSN=twilio://SID:TOKEN@default?from=FROM #SMS_DSN=twilio://SID:TOKEN@default?from=FROM
#SMS_DSN=brevo://API_KEY@default?sender=SENDER
SMS_DSN=null://null SMS_DSN=null://null
###< symfony/notifier ### ###< symfony/notifier ###
@ -106,3 +107,7 @@ STORAGE_USE_PATH_STYLE_ENDPOINT=true
STORAGE_KEY=app STORAGE_KEY=app
STORAGE_SECRET=!ChangeMe! STORAGE_SECRET=!ChangeMe!
###< league/flysystem-bundle ### ###< league/flysystem-bundle ###
###> symfony/brevo-notifier ###
# BREVO_DSN=brevo://API_KEY@default?sender=SENDER
###< symfony/brevo-notifier ###

View file

@ -51,6 +51,7 @@
"snc/redis-bundle": "^4.3", "snc/redis-bundle": "^4.3",
"stof/doctrine-extensions-bundle": "^1.7", "stof/doctrine-extensions-bundle": "^1.7",
"symfony/asset": "6.4.*", "symfony/asset": "6.4.*",
"symfony/brevo-notifier": "6.4.*",
"symfony/cache": "6.4.*", "symfony/cache": "6.4.*",
"symfony/clock": "6.4.*", "symfony/clock": "6.4.*",
"symfony/console": "6.4.*", "symfony/console": "6.4.*",

72
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "66ed0749f68e437c6d15a770e30ee54f", "content-hash": "f923f481246dcd1703ff8df8ada5ccc3",
"packages": [ "packages": [
{ {
"name": "alcohol/iso4217", "name": "alcohol/iso4217",
@ -8792,6 +8792,76 @@
], ],
"time": "2024-05-31T14:49:08+00:00" "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", "name": "symfony/cache",
"version": "v6.4.11", "version": "v6.4.11",

View file

@ -4,7 +4,6 @@ This page documents the settings that can be configured as environment varibles
for the production environment. for the production environment.
Defaults value are shown in the [.env](../.env) file. Defaults value are shown in the [.env](../.env) file.
## Application ## Application
| name | default value | | 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. 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 MAILER_DSN=gmail://email@example.com:secretkey@default
@ -58,14 +57,19 @@ Twilio, Sendgrid, Mailingblue...
SMS_DSN=null://null SMS_DSN=null://null
This is the main parameter to send DNS. If you leave `null://null`, nothing will This is the main parameter to send DNS. If you leave `null://null`, no SMS will
be send without errors. It can be useful when having issues with your SMS provider be sent.
and wanting to disable it temporarly. 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 ## Meilisearch

View file

@ -232,6 +232,15 @@
"config/packages/stof_doctrine_extensions.yaml" "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": { "symfony/console": {
"version": "6.1", "version": "6.1",
"recipe": { "recipe": {