Download the PHP package vzgcoders/twitchphp without Composer

On this page you can find all versions of the php package vzgcoders/twitchphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package twitchphp

TwitchPHP

An async ReactPHP framework for the Twitch Helix API, EventSub over WebSocket, and chat (IRC over WebSocket) — designed and built like DiscordPHP.

Requirements

Installation

The HTTP transport lives in its own package, twitchphp/http, and is pulled in automatically.

Windows and SSL

PHP on Windows has no access to the system certificate store. Download a CA bundle and point openssl.cafile in your php.ini at it, otherwise every TLS connection fails silently.

Authentication

Twitch has several OAuth flows; TwitchPHP supports the ones a bot or service needs.

You have… Pass Behaviour
A client id + secret only client_id, client_secret Requests an app access token (client-credentials). Good for public data and EventSub.
A user access token token (+ optional refresh_token) Validated on startup. With a refresh_token, an invalid/expired token is refreshed transparently, and any Helix 401 triggers one recover-and-retry.

Twitch\Http\OAuth also exposes authorizationUrl(), exchangeCode(), deviceCode(), validate() and revoke() for building the authorization-code / device-code flows in your own app.

Keeping a token alive

Twitch invalidates the previous refresh token every time it issues a new one, so a long-running client that refreshes without saving the result locks itself out of its own account as soon as the process restarts. Pass a token_store and the rotation is persisted for you; pass a reauthorize strategy and a grant that can no longer be refreshed is rebuilt from scratch:

A 401 is then refreshed, or re-authorized, and the request retried once. The exception is a missing scope: MissingScopeException surfaces immediately, naming the scopes that would have satisfied the call, because no amount of re-issuing widens a grant that was never asked for. See examples/self-healing-auth.php.

The Helix client

Resources hang off the client as repositories, mirroring DiscordPHP. 29 of them:

Every call returns a React\Promise\PromiseInterface. Collections are Discord\Helpers\Collection instances of hydrated Twitch\Parts\* models.

Repositories share a common surface from Twitch\Repository\AbstractRepository: freshen(), all() (auto-follows pagination.cursor), fetch($id), save($part), delete($part), plus get(), first(), filter() and iteration.

EventSub

Enable the WebSocket transport with 'eventsub' => true, then subscribe once the session is ready:

SubscriptionTypes has a constant for every EventSub type and knows the version Twitch currently wants for it. Session reconnects (session_reconnect), keepalives and revocation are handled for you, and the desired subscription set (deduplicated) is replayed automatically onto a fresh session after a drop.

Chat (IRC)

Pass a nick and channels to connect the chat client. It speaks IRCv3 over wss://irc-ws.chat.twitch.tv and parses tags into Twitch\Parts\ChatMessage parts.

Richer commands

Twitch\Chat\CommandClient layers aliases, per-user cooldowns, permission levels and an auto !help on top of the plain command event:

Moderators and the broadcaster bypass cooldowns; permission also accepts a fn (ChatMessage $m): bool predicate.

Events

Event Payload Notes
init / ready Twitch Authenticated and connected.
error \Throwable, Twitch
token_refreshed string $token, Twitch
closed Twitch After close().
eventsub string $type, array $event, array $meta, Twitch Every notification.
eventsub.<type> array $event, array $meta, Twitch e.g. eventsub.channel.chat.message.
eventsub.ready / eventsub.keepalive / eventsub.revoked / eventsub.disconnected
chat ChatMessage Any chat line.
command string $name, array $args, ChatMessage Prefix commands.

Configuration

Option Default
client_id — Required.
client_secret '' Enables the app-token flow.
token / refresh_token null A user token and its refresh token.
scopes [] Informational.
loop Loop::get() A React\EventLoop\LoopInterface.
logger NullLogger Any PSR-3 logger.
socket_options [] Passed to React\Socket\Connector.
nick null Set to connect the IRC client.
channels [] Normalised to #lowercase.
command_prefix '!'
eventsub false Set to connect the EventSub client.
token_store null A Twitch\Auth\TokenStoreInterface. Read at startup, written through on every token change.
reauthorize null A Twitch\Auth\ReauthorizerInterface, used when refreshing can no longer recover a grant.

Development

License

MIT — see LICENSE.


All versions of twitchphp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
twitchphp/http Version ^1.1
discord-php-helpers/collection Version dev-main
evenement/evenement Version ^3.0
nesbot/carbon Version ^3.8 || ^2.72
psr/log Version ^1.1 || ^2.0 || ^3.0
ratchet/pawl Version ^0.4.1
react/event-loop Version ^1.5
react/promise Version ^3.2 || ^2.11
react/socket Version ^1.16
symfony/options-resolver Version ^6.4 || ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vzgcoders/twitchphp contains the following files

Loading the files please wait ...