Download the PHP package savander/twservers without Composer
On this page you can find all versions of the php package savander/twservers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package twservers
TwServersInfo-php
PHP Library (+Laravel) - Teeworlds Servers Info This package, allows you to gather information from Teeworlds Servers as well as from TeeWorlds Master Servers.
Requirements
- PHP ^7.0
Composer
Require this package with composer using the following command:
To install this package on only development systems, add the --dev
flag to your composer command:
for Laravel
Laravel 5.5+
Laravel 5.5 introduced package autodiscover. It means, that you don't need to aliases and providers to your app by your own.
For Laravel 5.4~
After updating composer, add the service provider to the providers
array in config/app.php
Also, add the Facade to the aliases
array in config/app.php
Usage (examples based on Laravel Facade)
Teeworlds Servers
Gathering information from server/servers can consume some time.
You can add one or few servers to object by passing array
or ServerResolver
class directly to function. (You don't have to pass port
, by default it is 8303
)
To list every server you added, use getServers()
function
It will return list of servers you passed to object, with data from server.
You can automatically get Players from servers by using getPlayers()
function.
You can pass ServerResolverInterface
object, or string like ip:port
to get data from already added server.
To get specific server from already added, use function getServer(string $string)
ServerResolver
has some function, which you can use, check ServerResolverInterface
:
ServerResolverInterface.php
If server has players, ServerResolver stores PlayerInterface, which has some function as well: PlayerInterface
Teeworlds Master Servers
Gathering information from master servers can consume some time.
You can add one or few servers to object by passing array
or MasterServerResolver
class directly to function. (You don't have to pass port
, by default it is 8300
)
To list every server you added, use getMasterServers()
function
It will return list of servers you passed to object, with data from masterserver.
To get specific masterserver from already added, use function getMasterServer(string $string)
MasterServerResolver
has some function, which you can use, check MasterServerResolverInterface
:
MasterServerResolverInterface.php
Feel free to add your own version based on those interfaces.