1. Go to this page and download the library: Download hikari_no_yume/twitterbot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hikari_no_yume / twitterbot example snippets
class MyTwitterBot implements TweetDeviser {
public function devise(): string {
return "Hello, world!";
}
}
declare(strict_types=1);
use hikari_no_yume\TwitterBot\Tweeter;
ss_token, oauth_access_token_secret, consumer_key and consumer_key from a JSON file
// You can also get these from somewhere else and use $tweeter->setTwitterKeys($object)
$tweeter->loadTwitterKeysFromJSONFile("settings.json");
// Optional. Sets the interval between tweets, in minutes. The default is 30.
$tweeter->setTweetInterval(30);
// Optional. Sets how long to wait before retrying devising a tweet (if it threw a Throwable), in seconds. The default is 60.
$tweeter->setDeviseRetryInterval(60);
// Optional. Sets how long to wait before retrying sending a tweet (if it failed), in seconds. The default is 60.
$tweeter->setTweetRetryInterval(60);
// Runs the bot forever.
$tweeter->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.