1. Go to this page and download the library: Download voniersa/twitch-live-chat 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/ */
voniersa / twitch-live-chat example snippets
use voniersa\twitch\livechat\TwitchChatAdapter;
use voniersa\twitch\livechat\IrcConnector;
use voniersa\twitch\livechat\ConnectionVerifier;
$adapter = new TwitchChatAdapter(new IrcConnector(), new ConnectionVerifier());
$exampleObserver = new ExampleObserver();
$connection->attach($exampleObserver);
$connection->detach($exampleObserver);
use voniersa\twitch\livechat\MessageObserver;
class ExampleObserver implements MessageObserver
{
public function update(Message $message): void
{
// do here what ever you want ...
}
}
$adapter->readLiveChat($connection, 30);
$adapter->writeMessage($connection, ChannelName::fromString("#xxxxxx"), "This message is send to the live chat!");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.