Skip to content

Commit 846c397

Browse files
committed
feature #48084 [Notifier] Add Twitter notifier (nicolas-grekas)
This PR was merged into the 6.3 branch. Discussion ---------- [Notifier] Add Twitter notifier | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Let's make it easy to tweet from Symfony apps. ```php $tweet = new ChatMessage('Hello World', (new TwitterOptions()) ->attachImage(new File('/path/to/image.jpg'), 'Alt text for the image') ); $chatter->send($tweet->transport('twitter')); ``` The `TwitterOptions` class supports all options from [`/2/tweets`](https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets) and also supports adding alt text to images and subtitles to videos, all this using async uploads. `TwitterTransport::request()` is also exposed as public API to make authenticated requests to any other API endpoints. Commits ------- a9d621cca9 [Notifier] Add Twitter notifier
2 parents 22fc1ee + 296bab1 commit 846c397

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Exception/UnsupportedSchemeException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ class UnsupportedSchemeException extends LogicException
204204
'class' => Bridge\Twilio\TwilioTransportFactory::class,
205205
'package' => 'symfony/twilio-notifier',
206206
],
207+
'twitter' => [
208+
'class' => Bridge\Twitter\TwitterTransportFactory::class,
209+
'package' => 'symfony/twitter-notifier',
210+
],
207211
'vonage' => [
208212
'class' => Bridge\Vonage\VonageTransportFactory::class,
209213
'package' => 'symfony/vonage-notifier',

Tests/Exception/UnsupportedSchemeExceptionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
use Symfony\Component\Notifier\Bridge\Telnyx\TelnyxTransportFactory;
5757
use Symfony\Component\Notifier\Bridge\TurboSms\TurboSmsTransportFactory;
5858
use Symfony\Component\Notifier\Bridge\Twilio\TwilioTransportFactory;
59+
use Symfony\Component\Notifier\Bridge\Twitter\TwitterTransportFactory;
5960
use Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory;
6061
use Symfony\Component\Notifier\Bridge\Yunpian\YunpianTransportFactory;
6162
use Symfony\Component\Notifier\Bridge\Zendesk\ZendeskTransportFactory;
@@ -115,6 +116,7 @@ public static function setUpBeforeClass(): void
115116
TelnyxTransportFactory::class => false,
116117
TurboSmsTransportFactory::class => false,
117118
TwilioTransportFactory::class => false,
119+
TwitterTransportFactory::class => false,
118120
VonageTransportFactory::class => false,
119121
YunpianTransportFactory::class => false,
120122
ZendeskTransportFactory::class => false,
@@ -179,6 +181,7 @@ public function messageWhereSchemeIsPartOfSchemeToPackageMapProvider(): \Generat
179181
yield ['telnyx', 'symfony/telnyx-notifier'];
180182
yield ['turbosms', 'symfony/turbo-sms-notifier'];
181183
yield ['twilio', 'symfony/twilio-notifier'];
184+
yield ['twitter', 'symfony/twitter-notifier'];
182185
yield ['zendesk', 'symfony/zendesk-notifier'];
183186
yield ['zulip', 'symfony/zulip-notifier'];
184187
}

Transport.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
use Symfony\Component\Notifier\Bridge\Telnyx\TelnyxTransportFactory;
5252
use Symfony\Component\Notifier\Bridge\TurboSms\TurboSmsTransportFactory;
5353
use Symfony\Component\Notifier\Bridge\Twilio\TwilioTransportFactory;
54+
use Symfony\Component\Notifier\Bridge\Twitter\TwitterTransportFactory;
5455
use Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory;
5556
use Symfony\Component\Notifier\Bridge\Yunpian\YunpianTransportFactory;
5657
use Symfony\Component\Notifier\Bridge\Zendesk\ZendeskTransportFactory;
@@ -112,6 +113,7 @@ final class Transport
112113
TelnyxTransportFactory::class,
113114
TurboSmsTransportFactory::class,
114115
TwilioTransportFactory::class,
116+
TwitterTransportFactory::class,
115117
VonageTransportFactory::class,
116118
YunpianTransportFactory::class,
117119
ZendeskTransportFactory::class,

0 commit comments

Comments
 (0)