2017 © Pedro Peláez
 

library bukkit-swift-api

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

image

radic/bukkit-swift-api

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  • Wednesday, July 16, 2014
  • by radic
  • Repository
  • 1 Watchers
  • 0 Stars
  • 21 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel Bukkit SwiftAPI

Build Status Latest Stable Version License, (*1)

Wraps the Apache Thrift generated PHP library for SwiftAPI in a Laravel Package and provides easy access trough a Facade., (*2)

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., (*3)

Version 1.0.0

View changelog and todo, (*4)

Overview

Requirements
  • PHP >= 5.3
  • Laravel >= 4.0
Installation

Require with composer:, (*5)

composer require radic/bukkit-swift-api

Or add to composer.json:, (*6)

{
    "radic/bukkit-swift-api": "dev-master"
}

Register service provder and facade in app/config/app.php, (*7)

'providers' => array(
    // ..
    'Radic\BukkitSwiftApi\BukkitSwiftApiServiceProvider',
),
'aliases' => array(
    // ..
    'SwiftApi'               => 'Radic\BukkitSwiftApi\Facades\SwiftApi',
)
Configuration

Use php artisan config:publish radic/bukkit-swift-api to edit the default configuration., (*8)

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        
    )
);
Connecting

There are several ways to connect:, (*9)

// 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:, (*10)

$api = SwiftApi::connect();
if($api->isConnected())
{
    var_dump('Connected');
    $serverInfo = $api->getServer();
    $api->disconnect();
    var_dump($serverInfo);
}
else
{
    var_dump( $api->getConnectionException()->getMessage() );
}
API Methods
$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:, (*11)

$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, (*12)

Further reading
Examples and goodies

Check my Laravel Bukkit Console. A web based console to directly interact with your Bukkit Server., (*13)

Credits

License

GNU General Public License version 3 (GPLv3), (*14)

The Versions

16/07 2014

dev-master

9999999-dev https://github.com/RobinRadic/laravel-bukkit-swiftapi

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  Sources   Download

GNU General Public License version 3 (GPLv3)

The Requires

 

laravel minecraft bukkit swiftapi

08/07 2014

v1.0.0

1.0.0.0 https://github.com/RobinRadic/laravel-bukkit-swiftapi

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  Sources   Download

GNU General Public License version 3 (GPLv3)

The Requires

 

laravel minecraft bukkit swiftapi

08/07 2014

v0.3.0

0.3.0.0 https://github.com/RobinRadic/laravel-bukkit-swiftapi

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  Sources   Download

GNU General Public License version 3 (GPLv3)

The Requires

 

laravel minecraft bukkit swiftapi

08/07 2014

v0.2.1

0.2.1.0 https://github.com/RobinRadic/laravel-bukkit-swiftapi

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  Sources   Download

GNU General Public License version 3 (GPLv3)

The Requires

 

laravel minecraft bukkit swiftapi

08/07 2014

v0.2.0

0.2.0.0 https://github.com/RobinRadic/laravel-bukkit-swiftapi

SwiftApi PHP API wrapped in a laravel package for remote calls to a minecraft bukkit server.

  Sources   Download

GNU General Public License version 3 (GPLv3)

The Requires

 

laravel minecraft bukkit swiftapi