PHPackages                             publicuhc/minecraft-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. publicuhc/minecraft-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

publicuhc/minecraft-auth
========================

Fake Minecraft server for authentication checking

1.1.1(10y ago)271365GPL-3.0+PHP

Since Jun 20Pushed 9y ago2 watchersCompare

[ Source](https://github.com/Eluinhost/minecraft-auth)[ Packagist](https://packagist.org/packages/publicuhc/minecraft-auth)[ RSS](/packages/publicuhc-minecraft-auth/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

minecraft-auth
==============

[](#minecraft-auth)

[![SensioLabsInsight](https://camo.githubusercontent.com/3118e2c20a552d990dd29e25a31f795c0da43d4f1d130131b9ae0d6596122d58/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f65623266393933342d363436332d343363322d386232312d3165666235313163666438322f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/eb2f9934-6463-43c2-8b21-1efb511cfd82)

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)

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
=============

[](#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
===========

[](#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.

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

-&gt;setDescription(string); - Default: §4▁§e▂§4▃§e▄§4▅§e▆§4▇§e█ §4§l PHPAuthServer §e█§4▇§e▆§4▅§e▄§4▃§e▂§4▁ §c▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-&gt;setMaxPlayers(int) - Default: -1
-&gt;setOnlineCount(int) - Default: -1
-&gt;setVersion(string) - Default: 1.8+ -&gt;setProtocol(47) - Default: 47 -&gt;setOnlinePlayers(array) - Default: \[\]
-&gt;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.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~98 days

Total

6

Last Release

3955d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7514501?v=4)[Graham Howden](/maintainers/Eluinhost)[@Eluinhost](https://github.com/Eluinhost)

---

Tags

authAuthenticationminecraftyggdrasilauth-serverminecraft serverPHPAuthServer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/publicuhc-minecraft-auth/health.svg)

```
[![Health](https://phpackages.com/badges/publicuhc-minecraft-auth/health.svg)](https://phpackages.com/packages/publicuhc-minecraft-auth)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[kreait/firebase-tokens

A library to work with Firebase tokens

24040.8M14](/packages/kreait-firebase-tokens)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
