PHP code example of juggl / minecraft

1. Go to this page and download the library: Download juggl/minecraft 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/ */

    

juggl / minecraft example snippets


// config/app.php
'providers' => [
    ...
    Juggl\Minecraft\MinecraftServiceProvider::class,
    ...
];

// config/app.php
'aliases' => [
    ...
    'Minecraft' => Juggl\Minecraft\Facades\Minecraft::class,
    ...
];

$minecraft = new Juggl\Minecraft\Minecraft;

// Retrieve UUID (without dashes) based on the username provided.
$minecraft->getUuidFromName($username);

// Supply an optional UNIX timestamp to get the UUID of the user who owned that
// username at the time.
$minecraft->getUuidFromName($username, time() - (365 * 24 * 60 * 60));

// Get array of names the user has played as.
$minecraft->getNameHistory($uuid);

// Extract current username from UUID provided.
$minecraft->getNameFromUuid($uuid);

// Get array of objects with info about each user (username & UUID).
$minecraft->getUuidsFromNames(['Notch', 'jeb_', 'Dinnerbone']);

Minecraft::getUuidFromName($username);