PHPackages                             publicuhc/php-yggdrasil - 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/php-yggdrasil

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

publicuhc/php-yggdrasil
=======================

PHP Library for interacting with Mojang authentication servers

1.0.2(10y ago)426331GPL-3.0+PHP

Since Jun 20Pushed 10y ago2 watchersCompare

[ Source](https://github.com/Eluinhost/php-yggdrasil)[ Packagist](https://packagist.org/packages/publicuhc/php-yggdrasil)[ RSS](/packages/publicuhc-php-yggdrasil/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (1)

php-yggdrasil
=============

[](#php-yggdrasil)

[![SensioLabsInsight](https://camo.githubusercontent.com/88b98999fa59edd1d30b61bc3e02ed82f5f8c9d37766914104b7db9e570c3077/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66366237326134392d323836652d343663362d383262662d3664663331343234643663622f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/f6b72a49-286e-46c6-82bf-6df31424d6cb)

PHP Library for interacting with Mojang authentication servers.

Installation
------------

[](#installation)

Using composer add it to your requirements section:

```
{
    "require-dev": {
        "publicuhc/php-yggdrasil": "dev-master"
    }
}

```

Usage
-----

[](#usage)

First you need to get hold of a `Yggdrasil` instance, the only choice right now is `DefaultYggdrasil`

```
$yggdrasil = new DefaultYddrasil();

```

You can also pass the username/clientToken/accessToken in the constructor if needed, or alternatively use the setter methods.

You can then use the Yggdrasil instance to query against the server:

```
//set the username
$yggdrasil->setUsername('joe@blogs.com');

//authenticate with the password, sets accessToken/clientToken on success
$yggdrasil->authenticate('joeisthebest');

$clientToken = $yggdrasil->getClientToken();
$accessToken = $yggdrasil->getAccessToken();

```

Error Checking
--------------

[](#error-checking)

All API functions can throw the following:

`APIRequestException`

Thrown when the mojang servers returned errors for the request, the short error can be found at $ex-&gt;getShortMessage(), the full message can get found at $ex-&gt;getMessage(), and the cause (if set) can be found at $ex-&gt;getCause()

`InvalidParameterException`

Thrown when an API method was called and certain parameters were not set yet. e.g.

```
//username not set yet
$yg = new DefaultYggdrasil();

//will throw InvalidParameterException due to username not being set
$yg->authenticate('xxx');

$yg->setUsername('yyy');

//will run correctly
$yg->authenticate('xxx');

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~366 days

Total

3

Last Release

3699d ago

### Community

Maintainers

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

---

Top Contributors

[![Eluinhost](https://avatars.githubusercontent.com/u/7514501?v=4)](https://github.com/Eluinhost "Eluinhost (55 commits)")

---

Tags

authAuthenticationminecraftMojangyggdrasilauth-server

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/publicuhc-php-yggdrasil/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[google/auth

Google Auth Library for PHP

1.4k302.1M239](/packages/google-auth)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121269.8k1](/packages/ellaisys-aws-cognito)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k51](/packages/neuron-core-neuron-ai)[kreait/firebase-tokens

A library to work with Firebase tokens

23947.1M19](/packages/kreait-firebase-tokens)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

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