teamspeakphp / web-query
PHP TeamSpeak 3 WebQuery client
v0.2.2
2025-01-30 00:55 UTC
Requires
- php: ^8.4
- php-http/discovery: ^1.20
- psr/http-client: ^1.0.3
Requires (Dev)
- guzzlehttp/guzzle: ^7.9.2
- laravel/pint: ^1.20
- mockery/mockery: ^1.6.12
- pestphp/pest: ^3.7.4
- pestphp/pest-plugin-type-coverage: ^3.2.3
- phpstan/phpstan: ^2.1.2
- rector/rector: ^2.0.7
- symfony/var-dumper: ^7.2
README
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