Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.9 KB

README.md

File metadata and controls

63 lines (43 loc) · 1.9 KB

PHP TeamSpeak 3 WebQuery client

Latest Version on Packagist Tests Total Downloads

PHP TeamSpeak 3 WebQuery client.

Note: This package is still under active development and is not yet ready for production use.

Features

To see all commands that implemented, see COMMANDS.

Installation

Requires PHP 8.4+

You can install the package via composer:

composer require teamspeakphp/web-query

Usage

To print names of the all channels:

$teamspeak = TeamSpeak::client('100.100.100.100:10080', 'my-api-key', 1);
$channels = $teamspeak->channels()->list()->channels;

foreach ($channels as $channel) {
    echo 'Found channel '.$channel->name.PHP_EOL;
}

To print nicknames with IP addresses of the first 100 clients in the database:

$teamspeak = TeamSpeak::client('100.100.100.100:10080', 'my-api-key', 1);
$clients = $teamspeak->databaseClients()->list(limit: 100)->clients;

foreach ($clients as $client) {
    echo sprintf('Database client: %s (%s)', $client->nickname, $client->lastIpAddress);
}

Method TeamSpeak::client(...) connects to the server through ID of the virtual server, but you can connect through the port of your server using the factory:

$teamspeak = TeamSpeak::factory()
    ->withBaseUri('100.100.100.100:10080')
    ->withApiKey('my-api-key')
    ->withPort(9987)
    ->make();

Testing

composer test