PHP code example of planetteamspeak / ts3-php-framework
1. Go to this page and download the library: Download planetteamspeak/ts3-php-framework library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
planetteamspeak / ts3-php-framework example snippets
// load framework files
URI
$uri = "serverquery://username:[email protected]:10011/?server_port=9987";
// connect to above specified server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory($uri);
// spawn an object for the channel using a specified name
$ts3_Channel = $ts3_VirtualServer->channelGetByName("I do not exist");
}
catch(TeamSpeak3_Exception $e)
{
// print the error message returned by the server
echo "Error " . $e->getCode() . ": " . $e->getMessage();
}
use TeamSpeak3;
use TeamSpeak3_Exception;
class TeamspeakController extends Controller
{
public function doSomething()
{
try
{
// IPv4 connection URI
$uri = "serverquery://username:[email protected]:10011/?server_port=9987";
// Create new object of TS3 PHP Framework class
$TS3PHPFramework = new TeamSpeak3();
// connect to above specified server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = $TS3PHPFramework->factory($uri);
// spawn an object for the channel using a specified name
$ts3_Channel = $ts3_VirtualServer->channelGetByName("I do not exist");
}
catch(TeamSpeak3_Exception $e)
{
// print the error message returned by the server
return "Error " . $e->getCode() . ": " . $e->getMessage();
}
}
}
composer
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.