1. Go to this page and download the library: Download savander/twservers 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/ */
$servers = TwServers::addServers([
new ServerResolver('192.168.0.1', 8303),
new ServerResolver('192.168.0.2', 8305)
]
);
$servers = TwServers::addServer(
new ServerResolver('192.168.0.1')
);
$servers->getServers();
$servers = TwServers::getPlayers(
new ServerResolver('192.168.0.1')
);
# Array of Player objects
$players = $server->getPlayers();
# Index as a combination of ip and port => ip:port or
# ip (only if standard port 8303)
$server = $servers->getServer('192.168.0.1')
$servers = TwServers::addMasterServers([
new MasterServerResolver('master1.teeworlds.com', 8300),
new MasterServerResolver('master2.teeworlds.com', 8300),
new MasterServerResolver('master3.teeworlds.com'),
new MasterServerResolver('master4.teeworlds.com')
]
);
$servers = TwServers::addMasterServer(
new MasterServerResolver('master2.teeworlds.com')
);
$servers->getMasterServers();
# Index as a combination of ip and port => ip:port or
# ip (only if standard port 8300)
$server = $servers->getMasterServer('master2.teeworlds.com')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.