Download the PHP package publicuhc/minecraft-auth without Composer

On this page you can find all versions of the php package publicuhc/minecraft-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package minecraft-auth

minecraft-auth

SensioLabsInsight

PHP Library for running a 'fake' Minecraft server that checks authentications are correct with the session servers and kicks the player afterwards. Has a callback to change the disconnect message. I use if for verification codes to link minecraft accounts without needing them to input their password.

Install

Install via composer by adding "publicuhc/minecraft-auth": "dev-master" to your composer require.

Dependencies: Will be handled by composer on install, requires the PHP mcrypt extension to run. (You can install this on linux with apt-get install php5-mcrypt or similar)

Example Usage

use PublicUHC\MinecraftAuth\AuthServer\AuthServer;

$server = new AuthServer(25565, '0.0.0.0');

$server->on('login_success', function($username, $uuid, DisconnectPacket $packet){
    echo "USERNAME: $username, UUID: $uuid\n";
    $packet->setReason("USERNAME: $username, UUID: $uuid");
});

$server->on('status_request', function(StatusResponsePacket $packet) {
    $packet->setDescription('test server')
        ->setMaxPlayers(10)
        ->setOnlineCount(1000)
        ->setVersion('1.8+')
        ->setProtocol(47);
});

$server->start();

Explanation

new AuthServer(25565, '0.0.0.0');

Creates a new auth server to bind on the port 25565 and on all interfaces (0.0.0.0). If second parameter is ommited it will bind to 127.0.0.1 for localhost connections.

$server->on('login_success', function($username, $uuid, DisconnectPacket $packet){
    echo "USERNAME: $username, UUID: $uuid\n";
    $packet->setReason("USERNAME: $username, UUID: $uuid");
});

This is the login_success event. It is called whenever a successful connection has been made. Username is the username of the client connecting, UUID is the minecraft UUID (without -s). $packet is a DisconnectPacket object that will be sent to the client after the event. Use setReason (to set an array/string reason that will be json encoded before sending) or setReasonJSON (to set a pre-encoded json string).

$server->on('status_request', function(StatusResponsePacket $packet) {
    $packet->setDescription('test')
        ->setMaxPlayers(10)
        ->setOnlineCount(1000)
        ->setVersion('1.8+')
        ->setProtocol(47);
        ->setOnlinePlayers([
            [
                'name' => 'Eluinhost',
                'id'   => '000000000000-0000-0000-0000-00000000'
            ]
        ]);
});

This is the status_request event. It is called whenever a client requests data for the server list.

->setDescription(string); - Sets the description that shows up in the server list
->setMaxPlayers(int) - the number after the / on the list
->setOnlineCount(int) - the number before the / on the list
->setVersion(string) - If the client is connecting on a different protocol this version number will show instead of min/max players
->setProtocol(47) - The protocol version to set to, we only accept 47 so either set this to 47 or leave it out ->setOnlinePlayers(array) - An array of player names to show when hovering over the online count. For array format check the PHPDoc comment
->setFavicon(string) - The image in text format (i.e. data:image/png;base64,DATAHERE)

All of the method can be ignored. If they are not set the following will be set instead:

->setDescription(string); - Default: §4▁§e▂§4▃§e▄§4▅§e▆§4▇§e█ §4§l PHPAuthServer §e█§4▇§e▆§4▅§e▄§4▃§e▂§4▁ §c▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
->setMaxPlayers(int) - Default: -1
->setOnlineCount(int) - Default: -1
->setVersion(string) - Default: 1.8+ ->setProtocol(47) - Default: 47 ->setOnlinePlayers(array) - Default: []
->setFavicon(string) - Default: null (no favicon)

Due to the single thread nature of PHP all events will be blocking other code. If you run any long running processes in here it will stop processing other connections until it is complete. Either keep computation low or fork processes to run long running code.

`$server->start()`

Starts the server, nothing after this method will be called as it blocking, make sure to run everything you need before this.


All versions of minecraft-auth with dependencies

PHP Build Version
Package Version
Requires ext-mcrypt Version *
phpseclib/phpseclib Version ~0.3
publicuhc/php-yggdrasil Version ~1.0
marc-mabe/php-enum Version ~1.2
react/react Version ~0.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package publicuhc/minecraft-auth contains the following files

Loading the files please wait ....