Twitter Log Writer component
Gobline\Logger\Writer\TwitterLogWriter tweets log information (as private DM (direct messages)).
With the Twitter app installed, you have instant notifications on your mobile.
If your mobile carrier is supported, you can also activate SMS notfications.
- Create a new Twitter user for your web application and a Twitter App.
- Select the new App and change permissions to Read and Write.
- Generate consumer key, consumer secret, access token and access token secret (make sure you (re)generate after you have set the permissions).
$logger = new Gobline\Logger\Writer\TwitterLogWriter( $oAuthAccessToken, // your genenated access token $oAuthAccessTokenSecret, // your genenated access token secret $consumerKey, // your genenated consumer key $consumerKeySecret, // your genenated consumer key secret $receiverScreenName // the user account display name of the receiver ); $logger->info('hello world');
- you need two Twitter accounts for this to work: the twitter account sending the direct message, and the twitter account receiving it.
- the receiver account needs to follow the sender.
- Twitter will block consecutive duplicated messages.
You can install the Twitter Log Writer using the dependency management tool Composer. Run the require command to resolve and download the dependencies:
composer require gobline/logwriter-twitter