PHPackages                             vzgcoders/twitchphp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vzgcoders/twitchphp

ActiveLibrary

vzgcoders/twitchphp
===================

An unofficial API to interact with the IRC chat service used by Twitch.

2.0.3(2y ago)5207↓100%11PHP

Since Mar 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Valgorithms/TwitchPHP)[ Packagist](https://packagist.org/packages/vzgcoders/twitchphp)[ GitHub Sponsors](https://github.com/valzargaming)[ Patreon](https://www.patreon.com/valzargaming)[ RSS](/packages/vzgcoders-twitchphp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (13)Used By (1)

TwitchPHP
=========

[](#twitchphp)

A chat self-bot built with ReactPHP for the official [Twitch TV](https://www.twitch.tv) Internet Relay Chat (IRC) interface.

Before you start
----------------

[](#before-you-start)

Before you start using this Library, you **need** to know how PHP works, you need to know the language and you need to know how Event Loops and Promises work. This is a fundamental requirement before you start. Without this knowledge, you will only suffer.

FAQ
---

[](#faq)

1. Can I run TwitchPHP on a webserver (e.g. Apache, nginx)?
    - No, TwitchPHP will only run in CLI. If you want to have an interface for your bot you can integrate [react/http](https://github.com/ReactPHP/http) with your bot and run it through CLI.
2. PHP is running out of memory?
    - Try increase your memory limit using `ini_set('memory_limit', '-1');`.

Getting Started
---------------

[](#getting-started)

### Requirements

[](#requirements)

- PHP 8
    - This library is being built with PHP8 support in mind. PHP7 is no longer supported, but can easily be forked and modified to do so.
- Composer
- [DiscordPHP](https://github.com/discord-php/DiscordPHP/) (Optional)

### Windows and SSL

[](#windows-and-ssl)

Unfortunately PHP on Windows does not have access to the Windows Certificate Store. This is an issue because TLS gets used and as such certificate verification gets applied (turning this off is **not** an option).

You will notice this issue by your script exiting immediately after one loop turn without any errors. Unfortunately there is for some reason no error or exception.

As such users of this library need to download a [Certificate Authority extract](https://curl.haxx.se/docs/caextract.html) from the cURL website.
The path to the caextract must be set in the [`php.ini`](https://secure.php.net/manual/en/openssl.configuration.php) for `openssl.cafile`.

#### Recommended Extensions

[](#recommended-extensions)

- The latest PHP version.
- One of `ext-uv` (preferred), `ext-libev` or `evt-event` for a faster, and more performant event loop.
- `ext-mbstring` if handling non-english characters.

### Installing TwitchPHP

[](#installing-twitchphp)

TwitchPHP is installed using [Composer](https://getcomposer.org).

1. Run `composer require VZGCoders/TwitchPHP`. This will install the lastest release.
2. Include the Composer autoload file at the top of your main file:
    - `include __DIR__.'/vendor/autoload.php';`
3. Make a bot!

Configuration
-------------

[](#configuration)

1. Add the required "secret" and "nick" values.
2. Customize your commands and responses.

### Basic Example

[](#basic-example)

```
