2017 © Pedro Peláez
 

library minecraft-api

An API for validating a Minecraft user against Mojang's servers

image

navarr/minecraft-api

An API for validating a Minecraft user against Mojang's servers

  • Monday, December 14, 2015
  • by navarr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 327 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

MinecraftAPI

An API for validating a user against Mojang's servers written in PHP, (*1)

Installation

Assuming you have composer,, (*2)

php composer.phar require navarr/minecraft-api:2.*, (*3)

How to use

Using the MinecraftAPI is incredibly easy in PHP. Assuming that you have it installed via composer,, (*4)

<?php
    // composer autoload call

    use Navarr\MinecraftAPI\MinecraftAPI;
    use Navarr\MinecraftAPI\Exception\BadLoginException;
    use Navarr\MinecraftAPI\Exception\MigrationException;
    use Navarr\MinecraftAPI\Exception\BasicException;

    try {
        $minecraftApi = new MinecraftAPI($username, $password);
    } catch (BadLoginException $e) {
        // Invalid Credentials
    } catch (MigrationException $e) {
        // User tried to login with their minecraft name instead of their mojang account handle (and have migrated)
    } catch (BasicException $e) {
        // The account is a "basic" Minecraft account.  They have not purchased Minecraft.
    }

    $minecraftName = $minecraftApi->username;
    $accessToken = $minecraftApi->accessToken;
    $uuid = $minecraftApi->minecraftID;

License

MIT License (coming soon!), (*5)

The Versions

14/12 2015

dev-master

9999999-dev

An API for validating a Minecraft user against Mojang's servers

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

10/04 2014

2.0

2.0.0.0

An API for validating a Minecraft user against Mojang's servers

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

11/07 2013

v1.1

1.1.0.0

An API for validating a Minecraft user against Mojang's servers

  Sources   Download

MIT

The Requires

  • php >=5.3.0