SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.
radic/bukkit-swift-api is a Laravel package for swiftapi php api wrapped in a laravel package for remote calls to a minecraft bukkit server..
It currently has 0 GitHub stars and 38 downloads on Packagist (latest version v1.0.0).
Install it with composer require radic/bukkit-swift-api.
Discover more Laravel packages by radic
or browse all Laravel packages to compare alternatives.
Last updated
Wraps the Apache Thrift generated PHP library for SwiftAPI in a Laravel Package and provides easy access trough a Facade.
SwiftAPI is a Bukkit plugin that allows you to use the generated API to make simple calls to the Bukkit server over the webz. Or if wanted, you can generate it yourself using Apache Thrift. This makes SwiftAPI usable in almost any programming language.
Require with composer:
composer require radic/bukkit-swift-api
Or add to composer.json:
{
"radic/bukkit-swift-api": "dev-master"
}
Register service provder and facade in app/config/app.php
'providers' => array(
// ..
'Radic\BukkitSwiftApi\BukkitSwiftApiServiceProvider',
),
'aliases' => array(
// ..
'SwiftApi' => 'Radic\BukkitSwiftApi\Facades\SwiftApi',
)
Use php artisan config:publish radic/bukkit-swift-api to edit the default configuration.
array(
'global' => array(
'host' => 'localhost',
'port' => 21111,
'username' => 'admin',
'password' => 'test',
'salt' => 'saltines'
),
'my-other-server' => array(
'host' => '11.11.11.11',
'username' => 'admin',
'password' => 'test'
// If you left out config settings, it will use the global for that setting
)
);
There are several ways to connect:
// Uses global config settings
$api = SwiftAPI::connect();
// Define all connection parameters inline
$api = SwiftAPI::connect('ip-or-host', 4444, 'username', 'password', 'crypt-salt');
// null or left out parameters will default back to the global config
$api = SwiftAPI::connect('ip-or-host', null, 'username', 'password');
// Uses 'my-other-server' from conffig.
$api = SwiftAPI::connectTo('my-other-server');
Example connection:
$api = SwiftApi::connect();
if($api->isConnected())
{
var_dump('Connected');
$serverInfo = $api->getServer();
$api->disconnect();
var_dump($serverInfo);
}
else
{
var_dump( $api->getConnectionException()->getMessage() );
}
$api->addToWhitelist($name);
$api->announce($message);
$api->ban($name);
$api->banIp($ip);
$api->deOp($name, $notifyPlayer);
$api->getBannedIps();
$api->getBannedPlayers();
$api->getBukkitVersion();
$api->getConsoleMessages($since);
$api->getFileContents($fileName);
$api->getOfflinePlayer($name);
$api->getOfflinePlayers();
$api->getOps();
$api->getPlayer($name);
$api->getPlayers();
$api->getPlugin($name);
$api->getPlugins();
$api->getServer();
$api->getServerVersion();
$api->getWhitelist();
$api->getWorld($worldName);
$api->getWorlds();
$api->installPlugin($downloadUrl, $md5);
$api->kick($name, $message);
$api->op($name, $notifyPlayer);
$api->ping();
$api->reloadServer();
$api->removeFromWhitelist($name);
$api->replacePlugin($pluginName, $downloadUrl, $md5);
$api->runConsoleCommand($command);
$api->saveWorld($worldName);
$api->setFileContents($fileName, $fileContents);
$api->setGameMode($name, $mode);
$api->setPvp($worldName, $isPvp);
$api->setStorm($worldName, $hasStorm);
$api->setThundering($worldName, $isThundering);
$api->setWorldTime($worldName, $time);
$api->unBan($name);
$api->unBanIp($ip);
See here which methods return data, and how that data is structured. A quick example:
$api = SwiftApi::connect();
$calls[] = $api->getServer();
$calls[] = $api->getPlugins();
$calls[] = $api->getOfflinePlayers();
$calls[] = $api->ping();
$calls[] = $api->getOps();
$api->disconnect();
var_dump($calls);
You'll get something like this in return
Check my Laravel Bukkit Console. A web based console to directly interact with your Bukkit Server.
GNU General Public License version 3 (GPLv3)