PHPackages                             davidoc26/mojang-api - 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. davidoc26/mojang-api

ActiveLibrary

davidoc26/mojang-api
====================

Simple Mojang-API class

v2.2.1(3y ago)1509MITPHPPHP &gt;=7.4

Since May 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Davidoc26/mojang-api)[ Packagist](https://packagist.org/packages/davidoc26/mojang-api)[ RSS](/packages/davidoc26-mojang-api/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

mojang-api
==========

[](#mojang-api)

Simple and easy class to use

[![Latest Stable Version](https://camo.githubusercontent.com/76a63c8da9822788cc066a11f95158c21f0c1357e6f557bfa533a6d2ac6af9ee/687474703a2f2f706f7365722e707567782e6f72672f64617669646f6332362f6d6f6a616e672d6170692f76)](https://packagist.org/packages/davidoc26/mojang-api)[![Total Downloads](https://camo.githubusercontent.com/3a374b25b1074d94fb7da5f9f9f923b92b8dfa64a9648390eaa2e5d5463ce968/687474703a2f2f706f7365722e707567782e6f72672f64617669646f6332362f6d6f6a616e672d6170692f646f776e6c6f616473)](https://packagist.org/packages/davidoc26/mojang-api)[![License](https://camo.githubusercontent.com/bd713e088c356a9c68d9baddad67e822cef30292547ca7d981dee7bdac39013b/687474703a2f2f706f7365722e707567782e6f72672f64617669646f6332362f6d6f6a616e672d6170692f6c6963656e7365)](https://packagist.org/packages/davidoc26/mojang-api)[![PHP Version Require](https://camo.githubusercontent.com/1d0a6a0ecb3ba04b66a07fe600ec09bfeda7013a3e8a848abf35c50f4900fdc5/687474703a2f2f706f7365722e707567782e6f72672f64617669646f6332362f6d6f6a616e672d6170692f726571756972652f706870)](https://packagist.org/packages/davidoc26/mojang-api)

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

[](#installation)

```
composer require davidoc26/mojang-api
```

Usage
-----

[](#usage)

#### Get status of Mojang services

[](#get-status-of-mojang-services)

```
use Davidoc26\MojangAPI\MojangAPI;

$mojangAPI = new MojangAPI();

$services = $mojangAPI->apiStatus();

foreach ($services as $service) {
    echo $service->getName(); // the name of service
    echo $service->getStatus(); // can be green/yellow/red
}
```

#### Get UUID by username

[](#get-uuid-by-username)

```
$uuid = $mojangAPI->getUuid('Test'); // d8d5a9237b2043d8883b1150148d6955
```

#### Get username names history

[](#get-username-names-history)

```
$uuid = $mojangAPI->getUuid('Test');
$users = $mojangAPI->getNameHistory($uuid);

foreach ($users as $user) {
    echo $user->getName();
    echo date('d M | Y', $user->getChangedToAt()); // Be careful! getChangedToAt() can return null
}
```

#### Render user head

[](#render-user-head)

```
$url = $mojangAPI->getSkinUrl($uuid);
$head = $mojangAPI->renderHead($url, 300); // the second argument is the size of head
echo "";
```

#### Authentication

[](#authentication)

```
$user = $mojangAPI->authenticate('email','password');

$user->getName();
$user->getUuid();
$user->getAccessToken();
$user->nameAvailability($newName);

// You can also render the head of the current player.
$user->renderHead($size);
```

#### Check name availability

[](#check-name-availability)

```
$isAvailable = $mojangAPI->nameAvailability($username, $token); // bool
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Recently: every ~138 days

Total

7

Last Release

1274d ago

Major Versions

v1.1.0 → v2.0.02021-07-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/8061d60a3bf1bd404c04df6202ccd5e1abd26739124709ae350e2343d2800635?d=identicon)[Davidoc26](/maintainers/Davidoc26)

---

Top Contributors

[![Davidoc26](https://avatars.githubusercontent.com/u/65646045?v=4)](https://github.com/Davidoc26 "Davidoc26 (35 commits)")

---

Tags

phpminecraftMojangAPI

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/davidoc26-mojang-api/health.svg)

```
[![Health](https://phpackages.com/badges/davidoc26-mojang-api/health.svg)](https://phpackages.com/packages/davidoc26-mojang-api)
```

###  Alternatives

[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)

PHPackages © 2026

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