You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-7Lines changed: 28 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
13
13
This package makes it easy to send Laravel notifications using [Twitter](https://dev.twitter.com/rest/public). (Laravel 8+)
14
14
15
-
PS: v.7.0.0 only supports Laravel 10 and PHP 8.1. If you have an older Laravel application or PHP version, you can use an older version of this package. Be aware that these are no longer maintained.
15
+
PS: v8 now uses the new Twitter API V2. Please read the upgrade guide for your app [here](https://developer.twitter.com/en/docs/twitter-api/migrate/overview).
16
16
17
17
## Contents
18
18
@@ -37,7 +37,7 @@ PS: v.7.0.0 only supports Laravel 10 and PHP 8.1. If you have an older Laravel a
37
37
38
38
This package is part of the [Laravel Notification Channels](http://laravel-notification-channels.com/) project. It provides additional Laravel Notification channels to the ones given by [Laravel](https://laravel.com/docs/master/notifications) itself.
39
39
40
-
The Twitter channel makes it possible to send out Laravel notifications as a `Twitter status update `(post on the timeline) or as a `direct message`.
40
+
The Twitter channel makes it possible to send out Laravel notifications as a `Twitter tweet`(post on the timeline) or as a `direct message`.
You will need to [create](https://developer.twitter.com/apps/) a Twitter app to use this channel. Within this app, you will find the `keys and access tokens`. Place them inside your `.env` file. To load them, add this to your `config/services.php` file:
56
+
You will need to [create](https://developer.twitter.com/apps/) a Twitter app to use this channel. Within this app, you will find the `keys and access tokens`.
57
+
58
+
Your Twitter app `must be within a project`. Also, make sure to activate the `user authentication settings`:
To load them, add this to your `config/services.php` file:
57
80
58
81
```php
59
82
...
@@ -66,8 +89,6 @@ You will need to [create](https://developer.twitter.com/apps/) a Twitter app to
66
89
...
67
90
```
68
91
69
-
This will load the Twitter app data from the `.env` file. Make sure to use the same keys you have used like `TWITTER_CONSUMER_KEY`.
70
-
71
92
## Usage
72
93
73
94
To use this package, you need to create a notification class, like `NewsWasPublished` from the example below, in your Laravel application. Make sure to check out [Laravel's documentation](https://laravel.com/docs/master/notifications) for this process.
@@ -160,7 +181,7 @@ public function toTwitter(mixed $notifiable): TwitterMessage
160
181
}
161
182
````
162
183
> Note that the reply status ID will be ignored if you omit the author of the original tweet, according to Twitter docs.
163
-
### Send a direct message
184
+
### Send a direct message (NOT working with the FREE Twitter API plan!)
164
185
To send a Twitter direct message to a specific user, you will need the `TwitterDirectMessage` class. Provide the Twitter user handler as the first parameter and the message as the second one.
165
186
````php
166
187
public function toTwitter(mixed $notifiable): TwitterMessage
0 commit comments