diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index cd70004a6e5bc..d5970e407ecf2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -2759,7 +2759,6 @@ 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\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/notifier_transports.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php index 445fe2a4749ca..b1e5e96998de0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/notifier_transports.php @@ -126,10 +126,6 @@ ->parent('notifier.transport_factory.abstract') ->tag('texter.transport_factory') - ->set('notifier.transport_factory.sendinblue', Bridge\Sendinblue\SendinblueTransportFactory::class) - ->parent('notifier.transport_factory.abstract') - ->tag('texter.transport_factory') - ->set('notifier.transport_factory.iqsms', Bridge\Iqsms\IqsmsTransportFactory::class) ->parent('notifier.transport_factory.abstract') ->tag('texter.transport_factory') diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitattributes b/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitattributes deleted file mode 100644 index 84c7add058fb5..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -/Tests export-ignore -/phpunit.xml.dist export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitignore b/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitignore deleted file mode 100644 index c49a5d8df5c65..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/CHANGELOG.md b/src/Symfony/Component/Notifier/Bridge/Sendinblue/CHANGELOG.md deleted file mode 100644 index 63f4975e69d15..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/CHANGELOG.md +++ /dev/null @@ -1,22 +0,0 @@ -CHANGELOG -========= - -6.4 ---- - -* Deprecate the bridge (use Brevo instead) - -6.2 ---- - - * Use `SmsMessage->from` when defined - -5.3 ---- - - * The bridge is not marked as `@experimental` anymore - -5.2.0 ------ - - * Added the bridge diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE b/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE deleted file mode 100644 index f37c76b591dbd..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2019-present Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md b/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md deleted file mode 100644 index aa78d8f94429d..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md +++ /dev/null @@ -1,25 +0,0 @@ -Sendinblue Notifier -=================== - -Provides [Sendinblue](https://sendinblue.com) integration for Symfony Notifier. - -DSN example ------------ - -``` -SENDINBLUE_DSN=sendinblue://API_KEY@default?sender=SENDER -``` - -where: - - `API_KEY` is your api key from your Sendinblue account - - `SENDER` is your sender's phone number - -See more info at https://developers.sendinblue.com/reference#sendtransacsms - -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/Sendinblue/SendinblueTransport.php b/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php deleted file mode 100644 index ce44b626b76a2..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sendinblue; - -use Symfony\Component\Notifier\Exception\TransportException; -use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException; -use Symfony\Component\Notifier\Message\MessageInterface; -use Symfony\Component\Notifier\Message\SentMessage; -use Symfony\Component\Notifier\Message\SmsMessage; -use Symfony\Component\Notifier\Transport\AbstractTransport; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; -use Symfony\Contracts\HttpClient\HttpClientInterface; - -/** - * @author Pierre Tondereau - * - * @deprecated since Symfony 6.3, use BrevoTransport instead - */ -final class SendinblueTransport extends AbstractTransport -{ - protected const HOST = 'api.sendinblue.com'; - - private string $apiKey; - private string $sender; - - public function __construct(#[\SensitiveParameter] string $apiKey, string $sender, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null) - { - $this->apiKey = $apiKey; - $this->sender = $sender; - - parent::__construct($client, $dispatcher); - } - - public function __toString(): string - { - return sprintf('sendinblue://%s?sender=%s', $this->getEndpoint(), $this->sender); - } - - public function supports(MessageInterface $message): bool - { - return $message instanceof SmsMessage; - } - - protected function doSend(MessageInterface $message): SentMessage - { - if (!$message instanceof SmsMessage) { - throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message); - } - - $response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/v3/transactionalSMS/sms', [ - 'json' => [ - 'sender' => $message->getFrom() ?: $this->sender, - 'recipient' => $message->getPhone(), - 'content' => $message->getSubject(), - ], - 'headers' => [ - 'api-key' => $this->apiKey, - ], - ]); - - try { - $statusCode = $response->getStatusCode(); - } catch (TransportExceptionInterface $e) { - throw new TransportException('Could not reach the remote Sendinblue server.', $response, 0, $e); - } - - if (201 !== $statusCode) { - $error = $response->toArray(false); - - throw new TransportException('Unable to send the SMS: '.$error['message'], $response); - } - - $success = $response->toArray(false); - - $sentMessage = new SentMessage($message, (string) $this); - $sentMessage->setMessageId($success['messageId']); - - return $sentMessage; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php b/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php deleted file mode 100644 index f3e9f0fbee4af..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sendinblue; - -use Symfony\Component\Notifier\Bridge\Brevo\BrevoTransport; -use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; -use Symfony\Component\Notifier\Transport\AbstractTransportFactory; -use Symfony\Component\Notifier\Transport\Dsn; - -/** - * @author Pierre Tondereau - * - * @deprecated since Symfony 6.3, use BrevoTransportFactory instead - */ -final class SendinblueTransportFactory extends AbstractTransportFactory -{ - public function create(Dsn $dsn): SendinblueTransport - { - trigger_deprecation('symfony/sendinblue-notifier', '6.3', 'The "%s" class is deprecated, use "%s" instead.', SendinblueTransport::class, BrevoTransport::class); - - $scheme = $dsn->getScheme(); - - if ('sendinblue' !== $scheme) { - throw new UnsupportedSchemeException($dsn, 'sendinblue', $this->getSupportedSchemes()); - } - - $apiKey = $this->getUser($dsn); - $sender = $dsn->getRequiredOption('sender'); - $host = 'default' === $dsn->getHost() ? null : $dsn->getHost(); - $port = $dsn->getPort(); - - return (new SendinblueTransport($apiKey, $sender, $this->client, $this->dispatcher))->setHost($host)->setPort($port); - } - - protected function getSupportedSchemes(): array - { - return ['sendinblue']; - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php b/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php deleted file mode 100644 index 88e2025c71421..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportFactoryTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sendinblue\Tests; - -use Symfony\Component\Notifier\Bridge\Sendinblue\SendinblueTransportFactory; -use Symfony\Component\Notifier\Test\TransportFactoryTestCase; - -/** - * @group legacy - */ -final class SendinblueTransportFactoryTest extends TransportFactoryTestCase -{ - public function createFactory(): SendinblueTransportFactory - { - return new SendinblueTransportFactory(); - } - - public static function createProvider(): iterable - { - yield [ - 'sendinblue://host.test?sender=0611223344', - 'sendinblue://apiKey@host.test?sender=0611223344', - ]; - } - - public static function supportsProvider(): iterable - { - yield [true, 'sendinblue://apiKey@default?sender=0611223344']; - yield [false, 'somethingElse://apiKey@default?sender=0611223344']; - } - - public static function incompleteDsnProvider(): iterable - { - yield 'missing api_key' => ['sendinblue://default?sender=0611223344']; - } - - public static function missingRequiredOptionProvider(): iterable - { - yield 'missing option: sender' => ['sendinblue://apiKey@host.test']; - } - - public static function unsupportedSchemeProvider(): iterable - { - yield ['somethingElse://apiKey@default?sender=0611223344']; - yield ['somethingElse://apiKey@host']; // missing "sender" option - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php b/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php deleted file mode 100644 index 5b817adfdcc89..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Notifier\Bridge\Sendinblue\Tests; - -use Symfony\Component\HttpClient\MockHttpClient; -use Symfony\Component\Notifier\Bridge\Sendinblue\SendinblueTransport; -use Symfony\Component\Notifier\Exception\TransportException; -use Symfony\Component\Notifier\Message\ChatMessage; -use Symfony\Component\Notifier\Message\SmsMessage; -use Symfony\Component\Notifier\Test\TransportTestCase; -use Symfony\Component\Notifier\Tests\Transport\DummyMessage; -use Symfony\Contracts\HttpClient\HttpClientInterface; -use Symfony\Contracts\HttpClient\ResponseInterface; - -/** - * @group legacy - */ -final class SendinblueTransportTest extends TransportTestCase -{ - public static function createTransport(HttpClientInterface $client = null): SendinblueTransport - { - return (new SendinblueTransport('api-key', '0611223344', $client ?? new MockHttpClient()))->setHost('host.test'); - } - - public static function toStringProvider(): iterable - { - yield ['sendinblue://host.test?sender=0611223344', self::createTransport()]; - } - - public static function supportedMessagesProvider(): iterable - { - yield [new SmsMessage('0611223344', 'Hello!')]; - } - - public static function unsupportedMessagesProvider(): iterable - { - yield [new ChatMessage('Hello!')]; - yield [new DummyMessage()]; - } - - public function testSendWithErrorResponseThrowsTransportException() - { - $response = $this->createMock(ResponseInterface::class); - $response->expects($this->exactly(2)) - ->method('getStatusCode') - ->willReturn(400); - $response->expects($this->once()) - ->method('getContent') - ->willReturn(json_encode(['code' => 400, 'message' => 'bad request'])); - - $client = new MockHttpClient(static fn (): ResponseInterface => $response); - - $transport = self::createTransport($client); - - $this->expectException(TransportException::class); - $this->expectExceptionMessage('Unable to send the SMS: bad request'); - - $transport->send(new SmsMessage('phone', 'testMessage')); - } -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json b/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json deleted file mode 100644 index c6bb6195e7093..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "symfony/sendinblue-notifier", - "type": "symfony-notifier-bridge", - "description": "Symfony Sendinblue Notifier Bridge", - "keywords": ["sms", "sendinblue", "notifier"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Pierre Tondereau", - "email": "pierre.tondereau@protonmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.2", - "symfony/http-client": "^6.4|^7.0", - "symfony/notifier": "^6.4|^7.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Sendinblue\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist b/src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist deleted file mode 100644 index 62c3f7e077e33..0000000000000 --- a/src/Symfony/Component/Notifier/Bridge/Sendinblue/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - - ./Resources - ./Tests - ./vendor - - - diff --git a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php index de07686b87c95..e862865d97f1d 100644 --- a/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php +++ b/src/Symfony/Component/Notifier/Exception/UnsupportedSchemeException.php @@ -208,10 +208,6 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\Sendberry\SendberryTransportFactory::class, 'package' => 'symfony/sendberry-notifier', ], - 'sendinblue' => [ - 'class' => Bridge\Sendinblue\SendinblueTransportFactory::class, - 'package' => 'symfony/sendinblue-notifier', - ], 'simpletextin' => [ 'class' => Bridge\SimpleTextin\SimpleTextinTransportFactory::class, 'package' => 'symfony/simple-textin-notifier', diff --git a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php index 8efaf1c0ac8bf..11eb566d2ab0e 100644 --- a/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php +++ b/src/Symfony/Component/Notifier/Tests/Exception/UnsupportedSchemeExceptionTest.php @@ -74,7 +74,6 @@ public static function setUpBeforeClass(): void Bridge\Redlink\RedlinkTransportFactory::class => false, Bridge\RocketChat\RocketChatTransportFactory::class => false, Bridge\Sendberry\SendberryTransportFactory::class => false, - Bridge\Sendinblue\SendinblueTransportFactory::class => false, Bridge\SimpleTextin\SimpleTextinTransportFactory::class => false, Bridge\Sinch\SinchTransportFactory::class => false, Bridge\Slack\SlackTransportFactory::class => false, @@ -153,7 +152,6 @@ 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 ['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 535e05d11c868..a7627b9bcb323 100644 --- a/src/Symfony/Component/Notifier/Transport.php +++ b/src/Symfony/Component/Notifier/Transport.php @@ -76,7 +76,6 @@ final class Transport Bridge\RingCentral\RingCentralTransportFactory::class, Bridge\RocketChat\RocketChatTransportFactory::class, Bridge\Sendberry\SendberryTransportFactory::class, - Bridge\Sendinblue\SendinblueTransportFactory::class, Bridge\SimpleTextin\SimpleTextinTransportFactory::class, Bridge\Sinch\SinchTransportFactory::class, Bridge\Slack\SlackTransportFactory::class,