PHP code example of mattiabasone / mc-auth

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

    

mattiabasone / mc-auth example snippets


$MCAuth = new MCAuth\Api();

try {
    $account = $MCAuth->sendAuth("[email protected]", "mypassword");
    var_dump($account);
} catch (Exception $e) {
    echo $e->getMessage();
}

try {
    $uuid = $MCAuth->usernameToUuid("_Cyb3r");
    var_dump($uuid);
} catch (Exception $e) {
    echo $e->getMessage();
}

try {
    $username = $MCAuth->uuidToUsername("be1cac3b60f04e0dba12c77cc8e0ec21");
    var_dump($username);
} catch (Exception $e) {
    echo $e->getMessage();
}