Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghostzero/tmi
PHP Twitch Messaging Interface
https://github.com/ghostzero/tmi
chatbot irc php7 tmi tmi-cluster twitchdev
Last synced: about 2 months ago
JSON representation
PHP Twitch Messaging Interface
- Host: GitHub
- URL: https://github.com/ghostzero/tmi
- Owner: ghostzero
- License: mit
- Created: 2020-09-12T13:00:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-23T09:57:25.000Z (over 1 year ago)
- Last Synced: 2024-03-15T08:12:25.177Z (10 months ago)
- Topics: chatbot, irc, php7, tmi, tmi-cluster, twitchdev
- Language: PHP
- Homepage:
- Size: 206 KB
- Stars: 23
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# PHP Twitch Messaging Interface
## Introduction
Inspired by [tmi.js](https://github.com/tmijs/tmi.js) and [php-irc-client](https://github.com/jerodev/php-irc-client) this package is a full featured, high performance Twitch IRC client written in PHP 7.4.
Also have a look at [ghostzero/tmi-cluster](https://github.com/ghostzero/tmi-cluster). TMI Cluster is a Laravel package that makes the PHP TMI client scalable.
## Features
- Connecting to Twitch IRC with SSL
- Generic IRC Commands
- Supports Twitch IRC Tags (IRC v3)
- Supports Twitch IRC Membership
- Supports Twitch IRC Commands## Official Documentation
You can view our official documentation [here](https://tmiphp.com/docs/).
## Getting Started (w/o OAuth Token)
```php
use GhostZero\Tmi\Client;
use GhostZero\Tmi\ClientOptions;
use GhostZero\Tmi\Events\Twitch\MessageEvent;$client = new Client(new ClientOptions([
'connection' => [
'secure' => true,
'reconnect' => true,
'rejoin' => true,
],
'channels' => ['ghostzero']
]));$client->on(MessageEvent::class, function (MessageEvent $e) {
print "{$e->tags['display-name']}: {$e->message}";
});$client->connect();
```## Getting Started (w/ OAuth Token)
```php
use GhostZero\Tmi\Client;
use GhostZero\Tmi\ClientOptions;
use GhostZero\Tmi\Events\Twitch\MessageEvent;$client = new Client(new ClientOptions([
'options' => ['debug' => true],
'connection' => [
'secure' => true,
'reconnect' => true,
'rejoin' => true,
],
'identity' => [
'username' => 'ghostzero',
'password' => 'oauth:...',
],
'channels' => ['ghostzero']
]));$client->on(MessageEvent::class, function (MessageEvent $e) use ($client) {
if ($e->self) return;if (strtolower($e->message) === '!hello') {
$client->say($e->channel->getName(), "@{$e->user}, heya!");
}
});$client->connect();
```