From 41b11e9773573d2c5260e28b400cfa965c219a38 Mon Sep 17 00:00:00 2001 From: Pierre Tanguy Date: Tue, 9 May 2023 23:40:38 +0100 Subject: [PATCH 1/2] [Mailer] [Sendinblue] refacto sendinblue to brevo --- .../FrameworkExtension.php | 4 +- .../Resources/config/mailer_transports.php | 4 +- .../Resources/config/notifier_transports.php | 2 +- .../{Sendinblue => Brevo}/.gitattributes | 0 .../Bridge/{Sendinblue => Brevo}/.gitignore | 0 .../Bridge/{Sendinblue => Brevo}/CHANGELOG.md | 0 .../Bridge/{Sendinblue => Brevo}/LICENSE | 0 .../Bridge/{Sendinblue => Brevo}/README.md | 12 +-- .../Transport/BrevoApiTransportTest.php} | 32 +++---- .../Transport/BrevoTransportFactoryTest.php | 92 +++++++++++++++++++ .../Transport/BrevoApiTransport.php} | 10 +- .../Transport/BrevoSmtpTransport.php} | 6 +- .../Transport/BrevoTransportFactory.php} | 18 ++-- .../{Sendinblue => Brevo}/composer.json | 6 +- .../{Sendinblue => Brevo}/phpunit.xml.dist | 2 +- .../SendinblueTransportFactoryTest.php | 92 ------------------- .../Exception/UnsupportedSchemeException.php | 6 +- .../UnsupportedSchemeExceptionTest.php | 6 +- src/Symfony/Component/Mailer/Transport.php | 4 +- .../{Sendinblue => Brevo}/.gitattributes | 0 .../Bridge/{Sendinblue => Brevo}/.gitignore | 0 .../BrevoTransport.php} | 10 +- .../BrevoTransportFactory.php} | 14 +-- .../Bridge/{Sendinblue => Brevo}/CHANGELOG.md | 0 .../Bridge/{Sendinblue => Brevo}/LICENSE | 0 .../Bridge/{Sendinblue => Brevo}/README.md | 10 +- .../Tests/BrevoTransportFactoryTest.php} | 20 ++-- .../Tests/BrevoTransportTest.php} | 12 +-- .../{Sendinblue => Brevo}/composer.json | 8 +- .../{Sendinblue => Brevo}/phpunit.xml.dist | 2 +- .../Exception/UnsupportedSchemeException.php | 6 +- .../UnsupportedSchemeExceptionTest.php | 4 +- src/Symfony/Component/Notifier/Transport.php | 2 +- 33 files changed, 192 insertions(+), 192 deletions(-) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/.gitattributes (100%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/.gitignore (100%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/CHANGELOG.md (100%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/LICENSE (100%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/README.md (74%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue/Tests/Transport/SendinblueApiTransportTest.php => Brevo/Tests/Transport/BrevoApiTransportTest.php} (80%) create mode 100644 src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoTransportFactoryTest.php rename src/Symfony/Component/Mailer/Bridge/{Sendinblue/Transport/SendinblueApiTransport.php => Brevo/Transport/BrevoApiTransport.php} (94%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue/Transport/SendinblueSmtpTransport.php => Brevo/Transport/BrevoSmtpTransport.php} (75%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue/Transport/SendinblueTransportFactory.php => Brevo/Transport/BrevoTransportFactory.php} (64%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/composer.json (80%) rename src/Symfony/Component/Mailer/Bridge/{Sendinblue => Brevo}/phpunit.xml.dist (92%) delete mode 100644 src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueTransportFactoryTest.php rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/.gitattributes (100%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/.gitignore (100%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue/SendinblueTransport.php => Brevo/BrevoTransport.php} (89%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue/SendinblueTransportFactory.php => Brevo/BrevoTransportFactory.php} (62%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/CHANGELOG.md (100%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/LICENSE (100%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/README.md (57%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue/Tests/SendinblueTransportFactoryTest.php => Brevo/Tests/BrevoTransportFactoryTest.php} (58%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue/Tests/SendinblueTransportTest.php => Brevo/Tests/BrevoTransportTest.php} (81%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/composer.json (72%) rename src/Symfony/Component/Notifier/Bridge/{Sendinblue => Brevo}/phpunit.xml.dist (91%) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 9cbd4d2285ebc..223c4d9dc0957 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -2578,7 +2578,7 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co MailerBridge\OhMySmtp\Transport\OhMySmtpTransportFactory::class => 'mailer.transport_factory.ohmysmtp', MailerBridge\Postmark\Transport\PostmarkTransportFactory::class => 'mailer.transport_factory.postmark', MailerBridge\Sendgrid\Transport\SendgridTransportFactory::class => 'mailer.transport_factory.sendgrid', - MailerBridge\Sendinblue\Transport\SendinblueTransportFactory::class => 'mailer.transport_factory.sendinblue', + MailerBridge\Brevo\Transport\BrevoTransportFactory::class => 'mailer.transport_factory.brevo', MailerBridge\Amazon\Transport\SesTransportFactory::class => 'mailer.transport_factory.amazon', ]; @@ -2741,7 +2741,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $ NotifierBridge\RocketChat\RocketChatTransportFactory::class => 'notifier.transport_factory.rocket-chat', NotifierBridge\Sendberry\SendberryTransportFactory::class => 'notifier.transport_factory.sendberry', NotifierBridge\SimpleTextin\SimpleTextinTransportFactory::class => 'notifier.transport_factory.simple-textin', - NotifierBridge\Sendinblue\SendinblueTransportFactory::class => 'notifier.transport_factory.sendinblue', + NotifierBridge\Brevo\BrevoTransportFactory::class => 'notifier.transport_factory.brevo', NotifierBridge\Sinch\SinchTransportFactory::class => 'notifier.transport_factory.sinch', NotifierBridge\Slack\SlackTransportFactory::class => 'notifier.transport_factory.slack', NotifierBridge\Sms77\Sms77TransportFactory::class => 'notifier.transport_factory.sms77', diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php index d352eb5bee856..6d7f6af8cf2c1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php @@ -22,7 +22,7 @@ use Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory; use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory; use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoTransportFactory; use Symfony\Component\Mailer\Transport\AbstractTransportFactory; use Symfony\Component\Mailer\Transport\NativeTransportFactory; use Symfony\Component\Mailer\Transport\NullTransportFactory; @@ -88,7 +88,7 @@ ->parent('mailer.transport_factory.abstract') ->tag('mailer.transport_factory') - ->set('mailer.transport_factory.sendinblue', SendinblueTransportFactory::class) + ->set('mailer.transport_factory.brevo', BrevoTransportFactory::class) ->parent('mailer.transport_factory.abstract') ->tag('mailer.transport_factory') diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php index 474f013f000a5..3724d0f257119 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php @@ -122,7 +122,7 @@ ->parent('notifier.transport_factory.abstract') ->tag('texter.transport_factory') - ->set('notifier.transport_factory.sendinblue', Bridge\Sendinblue\SendinblueTransportFactory::class) + ->set('notifier.transport_factory.brevo', Bridge\Brevo\BrevoTransportFactory::class) ->parent('notifier.transport_factory.abstract') ->tag('texter.transport_factory') diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/.gitattributes b/src/Symfony/Component/Mailer/Bridge/Brevo/.gitattributes similarity index 100% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/.gitattributes rename to src/Symfony/Component/Mailer/Bridge/Brevo/.gitattributes diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/.gitignore b/src/Symfony/Component/Mailer/Bridge/Brevo/.gitignore similarity index 100% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/.gitignore rename to src/Symfony/Component/Mailer/Bridge/Brevo/.gitignore diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/CHANGELOG.md b/src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md similarity index 100% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/CHANGELOG.md rename to src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE b/src/Symfony/Component/Mailer/Bridge/Brevo/LICENSE similarity index 100% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/LICENSE rename to src/Symfony/Component/Mailer/Bridge/Brevo/LICENSE diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/README.md b/src/Symfony/Component/Mailer/Bridge/Brevo/README.md similarity index 74% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/README.md rename to src/Symfony/Component/Mailer/Bridge/Brevo/README.md index b0f9b16ae0c0f..5ee261433f479 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/README.md +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/README.md @@ -1,20 +1,20 @@ -Sendinblue Bridge +Brevo Bridge - formerly Sendinblue ================= -Provides Sendinblue integration for Symfony Mailer. +Provides Brevo integration for Symfony Mailer. Configuration example: ```env # SMTP -MAILER_DSN=sendinblue+smtp://USERNAME:PASSWORD@default +MAILER_DSN=brevo+smtp://USERNAME:PASSWORD@default # API -MAILER_DSN=sendinblue+api://KEY@default +MAILER_DSN=brevo+api://KEY@default ``` where: - - `KEY` is your Sendinblue API Key + - `KEY` is your Brevo API Key With API, you can use custom headers. @@ -44,7 +44,7 @@ This example allow you to set : * sender.ip * X-Mailin-Custom -For more informations, you can refer to [Sendinblue API documentation](https://developers.sendinblue.com/reference#sendtransacemail). +For more informations, you can refer to [Brevo API documentation](https://developers.brevo.com/reference/getting-started-1#sendtransacemail). Resources --------- diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoApiTransportTest.php similarity index 80% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php rename to src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoApiTransportTest.php index 2a6825b3a623a..9de26e0621284 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoApiTransportTest.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Mailer\Bridge\Sendinblue\Tests\Transport; +namespace Symfony\Component\Mailer\Bridge\Brevo\Tests\Transport; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueApiTransport; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoApiTransport; use Symfony\Component\Mailer\Envelope; use Symfony\Component\Mailer\Exception\HttpTransportException; use Symfony\Component\Mailer\Header\MetadataHeader; @@ -24,12 +24,12 @@ use Symfony\Component\Mime\Part\DataPart; use Symfony\Contracts\HttpClient\ResponseInterface; -class SendinblueApiTransportTest extends TestCase +class BrevoApiTransportTest extends TestCase { /** * @dataProvider getTransportData */ - public function testToString(SendinblueApiTransport $transport, string $expected) + public function testToString(BrevoApiTransport $transport, string $expected) { $this->assertSame($expected, (string) $transport); } @@ -37,18 +37,18 @@ public function testToString(SendinblueApiTransport $transport, string $expected public static function getTransportData() { yield [ - new SendinblueApiTransport('ACCESS_KEY'), - 'sendinblue+api://api.sendinblue.com', + new BrevoApiTransport('ACCESS_KEY'), + 'brevo+api://api.brevo.com', ]; yield [ - (new SendinblueApiTransport('ACCESS_KEY'))->setHost('example.com'), - 'sendinblue+api://example.com', + (new BrevoApiTransport('ACCESS_KEY'))->setHost('example.com'), + 'brevo+api://example.com', ]; yield [ - (new SendinblueApiTransport('ACCESS_KEY'))->setHost('example.com')->setPort(99), - 'sendinblue+api://example.com:99', + (new BrevoApiTransport('ACCESS_KEY'))->setHost('example.com')->setPort(99), + 'brevo+api://example.com:99', ]; } @@ -67,8 +67,8 @@ public function testCustomHeader() ; $envelope = new Envelope(new Address('alice@system.com', 'Alice'), [new Address('bob@system.com', 'Bob')]); - $transport = new SendinblueApiTransport('ACCESS_KEY'); - $method = new \ReflectionMethod(SendinblueApiTransport::class, 'getPayload'); + $transport = new BrevoApiTransport('ACCESS_KEY'); + $method = new \ReflectionMethod(BrevoApiTransport::class, 'getPayload'); $payload = $method->invoke($transport, $email, $envelope); $this->assertArrayHasKey('X-Mailin-Custom', $payload['headers']); @@ -89,7 +89,7 @@ public function testSendThrowsForErrorResponse() { $client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface { $this->assertSame('POST', $method); - $this->assertSame('https://api.sendinblue.com:8984/v3/smtp/email', $url); + $this->assertSame('https://api.brevo.com:8984/v3/smtp/email', $url); $this->assertStringContainsString('Accept: */*', $options['headers'][2] ?? $options['request_headers'][1]); return new MockResponse(json_encode(['message' => 'i\'m a teapot']), [ @@ -100,7 +100,7 @@ public function testSendThrowsForErrorResponse() ]); }); - $transport = new SendinblueApiTransport('ACCESS_KEY', $client); + $transport = new BrevoApiTransport('ACCESS_KEY', $client); $transport->setPort(8984); $mail = new Email(); @@ -119,7 +119,7 @@ public function testSend() { $client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface { $this->assertSame('POST', $method); - $this->assertSame('https://api.sendinblue.com:8984/v3/smtp/email', $url); + $this->assertSame('https://api.brevo.com:8984/v3/smtp/email', $url); $this->assertStringContainsString('Accept: */*', $options['headers'][2] ?? $options['request_headers'][1]); return new MockResponse(json_encode(['messageId' => 'foobar']), [ @@ -127,7 +127,7 @@ public function testSend() ]); }); - $transport = new SendinblueApiTransport('ACCESS_KEY', $client); + $transport = new BrevoApiTransport('ACCESS_KEY', $client); $transport->setPort(8984); $mail = new Email(); diff --git a/src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoTransportFactoryTest.php b/src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoTransportFactoryTest.php new file mode 100644 index 0000000000000..0d0f00e0a804c --- /dev/null +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/Tests/Transport/BrevoTransportFactoryTest.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Mailer\Bridge\Brevo\Tests\Transport; + +use Psr\Log\NullLogger; +use Symfony\Component\HttpClient\MockHttpClient; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoApiTransport; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoSmtpTransport; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoTransportFactory; +use Symfony\Component\Mailer\Test\TransportFactoryTestCase; +use Symfony\Component\Mailer\Transport\Dsn; +use Symfony\Component\Mailer\Transport\TransportFactoryInterface; + +class BrevoTransportFactoryTest extends TransportFactoryTestCase +{ + public function getFactory(): TransportFactoryInterface + { + return new BrevoTransportFactory(null, new MockHttpClient(), new NullLogger()); + } + + public static function supportsProvider(): iterable + { + yield [ + new Dsn('brevo', 'default'), + true, + ]; + + yield [ + new Dsn('brevo+smtp', 'default'), + true, + ]; + + yield [ + new Dsn('brevo+smtp', 'example.com'), + true, + ]; + + yield [ + new Dsn('brevo+api', 'default'), + true, + ]; + } + + public static function createProvider(): iterable + { + yield [ + new Dsn('brevo', 'default', self::USER, self::PASSWORD), + new BrevoSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), + ]; + + yield [ + new Dsn('brevo+smtp', 'default', self::USER, self::PASSWORD), + new BrevoSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), + ]; + + yield [ + new Dsn('brevo+smtp', 'default', self::USER, self::PASSWORD, 465), + new BrevoSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), + ]; + + yield [ + new Dsn('brevo+api', 'default', self::USER), + new BrevoApiTransport(self::USER, new MockHttpClient(), null, new NullLogger()), + ]; + } + + public static function unsupportedSchemeProvider(): iterable + { + yield [ + new Dsn('brevo+foo', 'default', self::USER, self::PASSWORD), + 'The "brevo+foo" scheme is not supported; supported schemes for mailer "brevo" are: "brevo", "brevo+smtp", "brevo+api".', + ]; + } + + public static function incompleteDsnProvider(): iterable + { + yield [new Dsn('brevo+smtp', 'default', self::USER)]; + + yield [new Dsn('brevo+smtp', 'default', null, self::PASSWORD)]; + + yield [new Dsn('brevo+api', 'default')]; + } +} diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoApiTransport.php similarity index 94% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueApiTransport.php rename to src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoApiTransport.php index d233769a37394..30cfcc55ef8a3 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoApiTransport.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Mailer\Bridge\Sendinblue\Transport; +namespace Symfony\Component\Mailer\Bridge\Brevo\Transport; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Log\LoggerInterface; @@ -30,7 +30,7 @@ /** * @author Yann LUCAS */ -final class SendinblueApiTransport extends AbstractApiTransport +final class BrevoApiTransport extends AbstractApiTransport { private string $key; @@ -43,7 +43,7 @@ public function __construct(string $key, HttpClientInterface $client = null, Eve public function __toString(): string { - return sprintf('sendinblue+api://%s', $this->getEndpoint()); + return sprintf('brevo+api://%s', $this->getEndpoint()); } protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $envelope): ResponseInterface @@ -61,7 +61,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e } catch (DecodingExceptionInterface) { throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode), $response); } catch (TransportExceptionInterface $e) { - throw new HttpTransportException('Could not reach the remote Sendinblue server.', $response, 0, $e); + throw new HttpTransportException('Could not reach the remote Brevo server.', $response, 0, $e); } if (201 !== $statusCode) { @@ -180,6 +180,6 @@ private function stringifyAddress(Address $address): array private function getEndpoint(): ?string { - return ($this->host ?: 'api.sendinblue.com').($this->port ? ':'.$this->port : ''); + return ($this->host ?: 'api.brevo.com').($this->port ? ':'.$this->port : ''); } } diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueSmtpTransport.php b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoSmtpTransport.php similarity index 75% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueSmtpTransport.php rename to src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoSmtpTransport.php index 797cf7c3b0b65..5c62efd57e60f 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueSmtpTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoSmtpTransport.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Mailer\Bridge\Sendinblue\Transport; +namespace Symfony\Component\Mailer\Bridge\Brevo\Transport; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Log\LoggerInterface; @@ -18,11 +18,11 @@ /** * @author Yann LUCAS */ -final class SendinblueSmtpTransport extends EsmtpTransport +final class BrevoSmtpTransport extends EsmtpTransport { public function __construct(string $username, #[\SensitiveParameter] string $password, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null) { - parent::__construct('smtp-relay.sendinblue.com', 465, true, $dispatcher, $logger); + parent::__construct('smtp-relay.brevo.com', 465, true, $dispatcher, $logger); $this->setUsername($username); $this->setPassword($password); diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueTransportFactory.php b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoTransportFactory.php similarity index 64% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueTransportFactory.php rename to src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoTransportFactory.php index 400c25f194115..ab015b2793322 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueTransportFactory.php +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoTransportFactory.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Mailer\Bridge\Sendinblue\Transport; +namespace Symfony\Component\Mailer\Bridge\Brevo\Transport; use Symfony\Component\Mailer\Exception\UnsupportedSchemeException; use Symfony\Component\Mailer\Transport\AbstractTransportFactory; @@ -19,22 +19,22 @@ /** * @author Yann LUCAS */ -final class SendinblueTransportFactory extends AbstractTransportFactory +final class BrevoTransportFactory extends AbstractTransportFactory { public function create(Dsn $dsn): TransportInterface { if (!\in_array($dsn->getScheme(), $this->getSupportedSchemes(), true)) { - throw new UnsupportedSchemeException($dsn, 'sendinblue', $this->getSupportedSchemes()); + throw new UnsupportedSchemeException($dsn, 'brevo', $this->getSupportedSchemes()); } switch ($dsn->getScheme()) { default: - case 'sendinblue': - case 'sendinblue+smtp': - $transport = SendinblueSmtpTransport::class; + case 'brevo': + case 'brevo+smtp': + $transport = BrevoSmtpTransport::class; break; - case 'sendinblue+api': - return (new SendinblueApiTransport($this->getUser($dsn), $this->client, $this->dispatcher, $this->logger)) + case 'brevo+api': + return (new BrevoApiTransport($this->getUser($dsn), $this->client, $this->dispatcher, $this->logger)) ->setHost('default' === $dsn->getHost() ? null : $dsn->getHost()) ->setPort($dsn->getPort()) ; @@ -45,6 +45,6 @@ public function create(Dsn $dsn): TransportInterface protected function getSupportedSchemes(): array { - return ['sendinblue', 'sendinblue+smtp', 'sendinblue+api']; + return ['brevo', 'brevo+smtp', 'brevo+api']; } } diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json b/src/Symfony/Component/Mailer/Bridge/Brevo/composer.json similarity index 80% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json rename to src/Symfony/Component/Mailer/Bridge/Brevo/composer.json index 1001eecddd040..6f01167a07b7f 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/composer.json @@ -1,7 +1,7 @@ { - "name": "symfony/sendinblue-mailer", + "name": "symfony/brevo-mailer", "type": "symfony-mailer-bridge", - "description": "Symfony Sendinblue Mailer Bridge", + "description": "Symfony Brevo Mailer Bridge", "keywords": [], "homepage": "https://symfony.com", "license": "MIT", @@ -26,7 +26,7 @@ "symfony/mime": "<6.2" }, "autoload": { - "psr-4": { "Symfony\\Component\\Mailer\\Bridge\\Sendinblue\\": "" }, + "psr-4": { "Symfony\\Component\\Mailer\\Bridge\\Brevo\\": "" }, "exclude-from-classmap": [ "/Tests/" ] diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/phpunit.xml.dist b/src/Symfony/Component/Mailer/Bridge/Brevo/phpunit.xml.dist similarity index 92% rename from src/Symfony/Component/Mailer/Bridge/Sendinblue/phpunit.xml.dist rename to src/Symfony/Component/Mailer/Bridge/Brevo/phpunit.xml.dist index 1c23309b9ae03..e7fba0dbaf8e8 100644 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/phpunit.xml.dist +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/phpunit.xml.dist @@ -13,7 +13,7 @@ - + ./Tests/ diff --git a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueTransportFactoryTest.php b/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueTransportFactoryTest.php deleted file mode 100644 index 08a5048c53d9e..0000000000000 --- a/src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueTransportFactoryTest.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Mailer\Bridge\Sendinblue\Tests\Transport; - -use Psr\Log\NullLogger; -use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueApiTransport; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueSmtpTransport; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory; -use Symfony\Component\Mailer\Test\TransportFactoryTestCase; -use Symfony\Component\Mailer\Transport\Dsn; -use Symfony\Component\Mailer\Transport\TransportFactoryInterface; - -class SendinblueTransportFactoryTest extends TransportFactoryTestCase -{ - public function getFactory(): TransportFactoryInterface - { - return new SendinblueTransportFactory(null, new MockHttpClient(), new NullLogger()); - } - - public static function supportsProvider(): iterable - { - yield [ - new Dsn('sendinblue', 'default'), - true, - ]; - - yield [ - new Dsn('sendinblue+smtp', 'default'), - true, - ]; - - yield [ - new Dsn('sendinblue+smtp', 'example.com'), - true, - ]; - - yield [ - new Dsn('sendinblue+api', 'default'), - true, - ]; - } - - public static function createProvider(): iterable - { - yield [ - new Dsn('sendinblue', 'default', self::USER, self::PASSWORD), - new SendinblueSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), - ]; - - yield [ - new Dsn('sendinblue+smtp', 'default', self::USER, self::PASSWORD), - new SendinblueSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), - ]; - - yield [ - new Dsn('sendinblue+smtp', 'default', self::USER, self::PASSWORD, 465), - new SendinblueSmtpTransport(self::USER, self::PASSWORD, null, new NullLogger()), - ]; - - yield [ - new Dsn('sendinblue+api', 'default', self::USER), - new SendinblueApiTransport(self::USER, new MockHttpClient(), null, new NullLogger()), - ]; - } - - public static function unsupportedSchemeProvider(): iterable - { - yield [ - new Dsn('sendinblue+foo', 'default', self::USER, self::PASSWORD), - 'The "sendinblue+foo" scheme is not supported; supported schemes for mailer "sendinblue" are: "sendinblue", "sendinblue+smtp", "sendinblue+api".', - ]; - } - - public static function incompleteDsnProvider(): iterable - { - yield [new Dsn('sendinblue+smtp', 'default', self::USER)]; - - yield [new Dsn('sendinblue+smtp', 'default', null, self::PASSWORD)]; - - yield [new Dsn('sendinblue+api', 'default')]; - } -} diff --git a/src/Symfony/Component/Mailer/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Mailer/Exception/UnsupportedSchemeException.php index b0612b23808fe..37681f3b056bc 100644 --- a/src/Symfony/Component/Mailer/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Mailer/Exception/UnsupportedSchemeException.php @@ -56,9 +56,9 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\Sendgrid\Transport\SendgridTransportFactory::class, 'package' => 'symfony/sendgrid-mailer', ], - 'sendinblue' => [ - 'class' => Bridge\Sendinblue\Transport\SendinblueTransportFactory::class, - 'package' => 'symfony/sendinblue-mailer', + 'brevo' => [ + 'class' => Bridge\Brevo\Transport\BrevoTransportFactory::class, + 'package' => 'symfony/brevo-mailer', ], 'ses' => [ 'class' => Bridge\Amazon\Transport\SesTransportFactory::class, diff --git a/src/Symfony/Component/Mailer/Tests/Exception/UnsupportedSchemeExceptionTest.php b/src/Symfony/Component/Mailer/Tests/Exception/UnsupportedSchemeExceptionTest.php index 5dcf0f1bbfd7c..84241425b0d36 100644 --- a/src/Symfony/Component/Mailer/Tests/Exception/UnsupportedSchemeExceptionTest.php +++ b/src/Symfony/Component/Mailer/Tests/Exception/UnsupportedSchemeExceptionTest.php @@ -23,7 +23,7 @@ use Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory; use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory; use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoTransportFactory; use Symfony\Component\Mailer\Exception\UnsupportedSchemeException; use Symfony\Component\Mailer\Transport\Dsn; @@ -45,7 +45,7 @@ public static function setUpBeforeClass(): void OhMySmtpTransportFactory::class => false, PostmarkTransportFactory::class => false, SendgridTransportFactory::class => false, - SendinblueTransportFactory::class => false, + BrevoTransportFactory::class => false, SesTransportFactory::class => false, ]); } @@ -74,7 +74,7 @@ public static function messageWhereSchemeIsPartOfSchemeToPackageMapProvider(): \ yield ['ohmysmtp', 'symfony/oh-my-smtp-mailer']; yield ['postmark', 'symfony/postmark-mailer']; yield ['sendgrid', 'symfony/sendgrid-mailer']; - yield ['sendinblue', 'symfony/sendinblue-mailer']; + yield ['brevo', 'symfony/brevo-mailer']; yield ['ses', 'symfony/amazon-mailer']; } diff --git a/src/Symfony/Component/Mailer/Transport.php b/src/Symfony/Component/Mailer/Transport.php index 2c6fdd5505e70..dd7acf279a387 100644 --- a/src/Symfony/Component/Mailer/Transport.php +++ b/src/Symfony/Component/Mailer/Transport.php @@ -23,7 +23,7 @@ use Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory; use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory; use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory; -use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory; +use Symfony\Component\Mailer\Bridge\Brevo\Transport\BrevoTransportFactory; use Symfony\Component\Mailer\Exception\InvalidArgumentException; use Symfony\Component\Mailer\Exception\UnsupportedSchemeException; use Symfony\Component\Mailer\Transport\Dsn; @@ -54,7 +54,7 @@ final class Transport OhMySmtpTransportFactory::class, PostmarkTransportFactory::class, SendgridTransportFactory::class, - SendinblueTransportFactory::class, + BrevoTransportFactory::class, SesTransportFactory::class, ]; diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Brevo/.gitattributes similarity index 100% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitattributes rename to src/Symfony/Component/Notifier/Bridge/Brevo/.gitattributes diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitignore b/src/Symfony/Component/Notifier/Bridge/Brevo/.gitignore similarity index 100% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitignore rename to src/Symfony/Component/Notifier/Bridge/Brevo/.gitignore diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php b/src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransport.php similarity index 89% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php rename to src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransport.php index dae546ba55eee..4c3dc1f42abe2 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransport.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Notifier\Bridge\Sendinblue; +namespace Symfony\Component\Notifier\Bridge\Brevo; use Symfony\Component\Notifier\Exception\TransportException; use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException; @@ -24,9 +24,9 @@ /** * @author Pierre Tondereau */ -final class SendinblueTransport extends AbstractTransport +final class BrevoTransport extends AbstractTransport { - protected const HOST = 'api.sendinblue.com'; + protected const HOST = 'api.brevo.com'; private string $apiKey; private string $sender; @@ -41,7 +41,7 @@ public function __construct(#[\SensitiveParameter] string $apiKey, string $sende public function __toString(): string { - return sprintf('sendinblue://%s?sender=%s', $this->getEndpoint(), $this->sender); + return sprintf('brevo://%s?sender=%s', $this->getEndpoint(), $this->sender); } public function supports(MessageInterface $message): bool @@ -71,7 +71,7 @@ protected function doSend(MessageInterface $message): SentMessage try { $statusCode = $response->getStatusCode(); } catch (TransportExceptionInterface $e) { - throw new TransportException('Could not reach the remote Sendinblue server.', $response, 0, $e); + throw new TransportException('Could not reach the remote Brevo server.', $response, 0, $e); } if (201 !== $statusCode) { diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php b/src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransportFactory.php similarity index 62% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php rename to src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransportFactory.php index 3d9eddf337bc9..22a988758fce9 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/BrevoTransportFactory.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Notifier\Bridge\Sendinblue; +namespace Symfony\Component\Notifier\Bridge\Brevo; use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; use Symfony\Component\Notifier\Transport\AbstractTransportFactory; @@ -18,14 +18,14 @@ /** * @author Pierre Tondereau */ -final class SendinblueTransportFactory extends AbstractTransportFactory +final class BrevoTransportFactory extends AbstractTransportFactory { - public function create(Dsn $dsn): SendinblueTransport + public function create(Dsn $dsn): BrevoTransport { $scheme = $dsn->getScheme(); - if ('sendinblue' !== $scheme) { - throw new UnsupportedSchemeException($dsn, 'sendinblue', $this->getSupportedSchemes()); + if ('brevo' !== $scheme) { + throw new UnsupportedSchemeException($dsn, 'brevo', $this->getSupportedSchemes()); } $apiKey = $this->getUser($dsn); @@ -33,11 +33,11 @@ public function create(Dsn $dsn): SendinblueTransport $host = 'default' === $dsn->getHost() ? null : $dsn->getHost(); $port = $dsn->getPort(); - return (new SendinblueTransport($apiKey, $sender, $this->client, $this->dispatcher))->setHost($host)->setPort($port); + return (new BrevoTransport($apiKey, $sender, $this->client, $this->dispatcher))->setHost($host)->setPort($port); } protected function getSupportedSchemes(): array { - return ['sendinblue']; + return ['brevo']; } } diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/CHANGELOG.md b/src/Symfony/Component/Notifier/Bridge/Brevo/CHANGELOG.md similarity index 100% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/CHANGELOG.md rename to src/Symfony/Component/Notifier/Bridge/Brevo/CHANGELOG.md diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE b/src/Symfony/Component/Notifier/Bridge/Brevo/LICENSE similarity index 100% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE rename to src/Symfony/Component/Notifier/Bridge/Brevo/LICENSE diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md b/src/Symfony/Component/Notifier/Bridge/Brevo/README.md similarity index 57% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md rename to src/Symfony/Component/Notifier/Bridge/Brevo/README.md index aa78d8f94429d..00697953ce67c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/README.md @@ -1,20 +1,20 @@ -Sendinblue Notifier +Brevo Notifier - formerly Sendinblue =================== -Provides [Sendinblue](https://sendinblue.com) integration for Symfony Notifier. +Provides [Brevo](https://brevo.com) integration for Symfony Notifier. DSN example ----------- ``` -SENDINBLUE_DSN=sendinblue://API_KEY@default?sender=SENDER +BREVO_DSN=brevo://API_KEY@default?sender=SENDER ``` where: - - `API_KEY` is your api key from your Sendinblue account + - `API_KEY` is your api key from your Breco account - `SENDER` is your sender's phone number -See more info at https://developers.sendinblue.com/reference#sendtransacsms +See more info at https://developers.brevo.com/reference/getting-started-1#sendtransacsms Resources --------- diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php b/src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportFactoryTest.php similarity index 58% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php rename to src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportFactoryTest.php index 322f07e041495..07a9185afbd36 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportFactoryTest.php @@ -9,40 +9,40 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Notifier\Bridge\Sendinblue\Tests; +namespace Symfony\Component\Notifier\Bridge\Brevo\Tests; -use Symfony\Component\Notifier\Bridge\Sendinblue\SendinblueTransportFactory; +use Symfony\Component\Notifier\Bridge\Brevo\BrevoTransportFactory; use Symfony\Component\Notifier\Test\TransportFactoryTestCase; -final class SendinblueTransportFactoryTest extends TransportFactoryTestCase +final class BrevoTransportFactoryTest extends TransportFactoryTestCase { - public function createFactory(): SendinblueTransportFactory + public function createFactory(): BrevoTransportFactory { - return new SendinblueTransportFactory(); + return new BrevoTransportFactory(); } public static function createProvider(): iterable { yield [ - 'sendinblue://host.test?sender=0611223344', - 'sendinblue://apiKey@host.test?sender=0611223344', + 'brevo://host.test?sender=0611223344', + 'brevo://apiKey@host.test?sender=0611223344', ]; } public static function supportsProvider(): iterable { - yield [true, 'sendinblue://apiKey@default?sender=0611223344']; + yield [true, 'brevo://apiKey@default?sender=0611223344']; yield [false, 'somethingElse://apiKey@default?sender=0611223344']; } public static function incompleteDsnProvider(): iterable { - yield 'missing api_key' => ['sendinblue://default?sender=0611223344']; + yield 'missing api_key' => ['brevo://default?sender=0611223344']; } public static function missingRequiredOptionProvider(): iterable { - yield 'missing option: sender' => ['sendinblue://apiKey@host.test']; + yield 'missing option: sender' => ['brevo://apiKey@host.test']; } public static function unsupportedSchemeProvider(): iterable diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php b/src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportTest.php similarity index 81% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php rename to src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportTest.php index f2d2f2bfad73f..cfdad9f6207e4 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/Tests/BrevoTransportTest.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Notifier\Bridge\Sendinblue\Tests; +namespace Symfony\Component\Notifier\Bridge\Brevo\Tests; use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\Notifier\Bridge\Sendinblue\SendinblueTransport; +use Symfony\Component\Notifier\Bridge\Brevo\BrevoTransport; use Symfony\Component\Notifier\Exception\TransportException; use Symfony\Component\Notifier\Message\ChatMessage; use Symfony\Component\Notifier\Message\SmsMessage; @@ -21,16 +21,16 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; -final class SendinblueTransportTest extends TransportTestCase +final class BrevoTransportTest extends TransportTestCase { - public static function createTransport(HttpClientInterface $client = null): SendinblueTransport + public static function createTransport(HttpClientInterface $client = null): BrevoTransport { - return (new SendinblueTransport('api-key', '0611223344', $client ?? new MockHttpClient()))->setHost('host.test'); + return (new BrevoTransport('api-key', '0611223344', $client ?? new MockHttpClient()))->setHost('host.test'); } public static function toStringProvider(): iterable { - yield ['sendinblue://host.test?sender=0611223344', self::createTransport()]; + yield ['brevo://host.test?sender=0611223344', self::createTransport()]; } public static function supportedMessagesProvider(): iterable diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json b/src/Symfony/Component/Notifier/Bridge/Brevo/composer.json similarity index 72% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json rename to src/Symfony/Component/Notifier/Bridge/Brevo/composer.json index 686f3e42c6812..5e51f2a60238b 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/composer.json @@ -1,8 +1,8 @@ { - "name": "symfony/sendinblue-notifier", + "name": "symfony/brevo-notifier", "type": "symfony-notifier-bridge", - "description": "Symfony Sendinblue Notifier Bridge", - "keywords": ["sms", "sendinblue", "notifier"], + "description": "Symfony brevo Notifier Bridge", + "keywords": ["sms", "brevo", "notifier"], "homepage": "https://symfony.com", "license": "MIT", "authors": [ @@ -21,7 +21,7 @@ "symfony/notifier": "^6.2.7" }, "autoload": { - "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Sendinblue\\": "" }, + "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Brevo\\": "" }, "exclude-from-classmap": [ "/Tests/" ] diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist b/src/Symfony/Component/Notifier/Bridge/Brevo/phpunit.xml.dist similarity index 91% rename from src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist rename to src/Symfony/Component/Notifier/Bridge/Brevo/phpunit.xml.dist index 62c3f7e077e33..a185c4f2adf76 100644 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist +++ b/src/Symfony/Component/Notifier/Bridge/Brevo/phpunit.xml.dist @@ -13,7 +13,7 @@ - + ./Tests/ diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php index 5b8cb22b82682..cb5987870653d 100644 --- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php @@ -188,9 +188,9 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\Sendberry\SendberryTransportFactory::class, 'package' => 'symfony/sendberry-notifier', ], - 'sendinblue' => [ - 'class' => Bridge\Sendinblue\SendinblueTransportFactory::class, - 'package' => 'symfony/sendinblue-notifier', + 'brevo' => [ + 'class' => Bridge\Brevo\BrevoTransportFactory::class, + 'package' => 'symfony/brevo-notifier', ], 'simpletextin' => [ 'class' => Bridge\SimpleTextin\SimpleTextinTransportFactory::class, diff --git a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php index 74176133ee2ae..a46c0a9ae1024 100644 --- a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php +++ b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php @@ -69,7 +69,7 @@ public static function setUpBeforeClass(): void Bridge\RingCentral\RingCentralTransportFactory::class => false, Bridge\RocketChat\RocketChatTransportFactory::class => false, Bridge\Sendberry\SendberryTransportFactory::class => false, - Bridge\Sendinblue\SendinblueTransportFactory::class => false, + Bridge\Brevo\BrevoTransportFactory::class => false, Bridge\SimpleTextin\SimpleTextinTransportFactory::class => false, Bridge\Sinch\SinchTransportFactory::class => false, Bridge\Slack\SlackTransportFactory::class => false, @@ -142,7 +142,7 @@ public static function messageWhereSchemeIsPartOfSchemeToPackageMapProvider(): \ yield ['ringcentral', 'symfony/ring-central-notifier']; yield ['rocketchat', 'symfony/rocket-chat-notifier']; yield ['sendberry', 'symfony/sendberry-notifier']; - yield ['sendinblue', 'symfony/sendinblue-notifier']; + yield ['brevo', 'symfony/brevo-notifier']; yield ['simpletextin', 'symfony/simple-textin-notifier']; yield ['sinch', 'symfony/sinch-notifier']; yield ['slack', 'symfony/slack-notifier']; diff --git a/src/Symfony/Component/Notifier/Transport.php b/src/Symfony/Component/Notifier/Transport.php index fa37f6c9b5848..37adbfc5b1361 100644 --- a/src/Symfony/Component/Notifier/Transport.php +++ b/src/Symfony/Component/Notifier/Transport.php @@ -71,7 +71,7 @@ final class Transport Bridge\RingCentral\RingCentralTransportFactory::class, Bridge\RocketChat\RocketChatTransportFactory::class, Bridge\Sendberry\SendberryTransportFactory::class, - Bridge\Sendinblue\SendinblueTransportFactory::class, + Bridge\Brevo\BrevoTransportFactory::class, Bridge\SimpleTextin\SimpleTextinTransportFactory::class, Bridge\Sinch\SinchTransportFactory::class, Bridge\Slack\SlackTransportFactory::class, From 0a532d045d65811bbb303d94a1df10de96ba4d4e Mon Sep 17 00:00:00 2001 From: Pierre Tanguy Date: Tue, 9 May 2023 23:53:10 +0100 Subject: [PATCH 2/2] [Mailer] [Sendinblue] added changelog --- src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md b/src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md index 0d994e934e55a..83a6833c35121 100644 --- a/src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md +++ b/src/Symfony/Component/Mailer/Bridge/Brevo/CHANGELOG.md @@ -5,3 +5,7 @@ CHANGELOG ----- * Added the bridge + +6.3.0 +---- +* renamed from Sendinblue to Brevo