Appearance
HasExtensionsMethods
php
trait Zairakai\LaravelTwitch\Services\Concerns\HasExtensionsMethodsTwitch Extensions API methods.
Extensions are interactive overlays and panels that enhance the Twitch viewer experience. Note: Most of these endpoints require an Extension Client ID and JWT signed with the extension secret.
Source: src/Services/Concerns/HasExtensionsMethods.php
Methods
createExtensionSecret()
php
public function createExtensionSecret(string $extensionId, int $delay = 300): arrayCreate a shared secret for the extension (rotates signing key).
| Parameter | Description |
|---|---|
$delay | Seconds before the previous secret expires (300–900) |
Returns array<string, mixed>
getExtension()
php
public function getExtension(string $extensionId, string $extensionVersion = null): arrayGet the specified extension.
Returns array<string, mixed>
getExtensionBitsProducts()
php
public function getExtensionBitsProducts(string $extensionClientId, bool $shouldIncludeAll = false): arrayGet the list of Bits products that belongs to the extension.
Returns array<string, mixed>
getExtensionConfigurationSegment()
php
public function getExtensionConfigurationSegment(string $extensionId, string $segment, string $broadcasterId = null): arrayGet a segment of the extension's configuration (global, broadcaster, or developer).
| Parameter | Description |
|---|---|
$extensionId | Extension client ID |
$segment | global, broadcaster, or developer |
$broadcasterId | Required for broadcaster/developer segments |
Returns array<string, mixed>
getExtensionLiveChannels()
php
public function getExtensionLiveChannels(string $extensionId, int $first = 20, string $after = null): arrayGet a list of broadcasters that are streaming live and have installed or activated the extension.
Returns array<string, mixed>
getExtensionSecrets()
php
public function getExtensionSecrets(string $extensionId): arrayGet the list of secret tokens for the extension.
Returns array<string, mixed>
getReleasedExtension()
php
public function getReleasedExtension(string $extensionId, string $extensionVersion = null): arrayGet the specified extension's most current version. Released extensions only.
Returns array<string, mixed>
sendExtensionChatMessage()
php
public function sendExtensionChatMessage(string $broadcasterId, string $extensionId, string $extensionVersion, string $text): voidSend a chat message to the broadcaster's chat room on behalf of an extension.
sendExtensionPubSubMessage()
php
public function sendExtensionPubSubMessage(string $broadcasterId, string $extensionId, string $message, array $targets = ['broadcast']): voidSend a PubSub message to one or more clients listening to the broadcaster's channel.
| Parameter | Description |
|---|---|
$targets | broadcast, global, or user IDs |
setExtensionConfigurationSegment()
php
public function setExtensionConfigurationSegment(string $extensionId, string $segment, string $broadcasterId = null, string $content = null, string $version = null): voidSet a configuration segment for an extension.
| Parameter | Description |
|---|---|
$extensionId | Extension client ID |
$segment | global, broadcaster, or developer |
$broadcasterId | Required for broadcaster/developer segments |
$content | Serialized JSON string (max 5KB) |
$version | Configuration version for optimistic locking |
setExtensionRequiredConfiguration()
php
public function setExtensionRequiredConfiguration(string $broadcasterId, string $extensionId, string $extensionVersion, string $configurationVersion): voidEnable activation of a specific extension on the broadcaster's channel.
updateExtensionBitsProduct()
php
public function updateExtensionBitsProduct(string $extensionClientId, array $data): arrayAdd or update a Bits product that the extension created.
| Parameter | Description |
|---|---|
$data | Product data (sku, cost, in_development, display_name, etc.) |
Returns array<string, mixed>