PHPackages                             mathmark/stupid-simple-matchmaking - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mathmark/stupid-simple-matchmaking

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mathmark/stupid-simple-matchmaking
==================================

PHP Matchmaking system, useful for Live Service games!

v1.0.3(1y ago)67MITPHP

Since Nov 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BigMark824/StupidSimpleMatchmaking)[ Packagist](https://packagist.org/packages/mathmark/stupid-simple-matchmaking)[ RSS](/packages/mathmark-stupid-simple-matchmaking/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (5)Used By (0)

Stupid Simple Matchmaking
=========================

[](#stupid-simple-matchmaking)

PHP Library used for simple equal distance matchmaking, great for Live Service Games!

### Installation

[](#installation)

Simply run `composer require mathmark/stupid-simple-matchmaking` in any PHP project setup with composer!

### StupidSimple\\Game\\Matchmaking

[](#stupidsimplegamematchmaking)

This is where all the magic happens! All our matchmaking functionality is called here.

### Constructor

[](#constructor)

- `private int $clientIpAddress` This is our base Client Address, this is what helps us find a server for a user
- `private ?array $availableGameServers;` This is an array populated with the metadata for our available GameServers

#### The structure should look like this

[](#the-structure-should-look-like-this)

```
[
  {
    "name": "US-PROD-1",
    "ipAddress": "192.168.1.10"
  },
  {
    "name": "CHI-PROD-1",
    "ipAddress": "192.168.1.20"
  },
]
```

### Functions

[](#functions)

- `getRandomServer() : array` This returns an ipAddress &amp; name for a random GameServer available
- `getClosestServer() : array` This is where we utilise our `$clientIpAddress`, this will return an ipAddress &amp; name for a GameServer thats closest to our User/Client

**Note:** If a name isn't provided for the server, one will be generated. **However** this is not recommended as it isn't great for organisation and is not consistent.

### How this works &amp; what is tracked?

[](#how-this-works--what-is-tracked)

Our service uses a trusted web API ([ip-api](https://ip-api.com/)) to get metadata for our client and server (such as Geolocation &amp; CountryCode), it then uses this information to MatchMake our user.

### Example Code

[](#example-code)

```
use StupidSimple\Game\Matchmaking;

$availableGameServers = [
    [
        "name" => "US-PROD-1",
        "ipAddress" => "192.168.1.10"
    ],
    [
        "name" => "CHI-PROD-1",
        "ipAddress" => "192.168.1.20"
    ]
];

$clientIp = $_SERVER['REMOTE_ADDR'];

$matchmaking = new Matchmaking($clientIp, $servers);

$closestServer = $matchmaking->getClosestServer();
exit(json_encode($closestServer));
```

#### Example Response

[](#example-response)

`getClosestServer()` &amp;&amp; `getRandomServer()` both respectively return this array

```
{
    "serverName" : "US-PROD-1",
    "serverAddress" : "192.168.1.10"
}
```

`getClosestServer()` also returns the distance in the array, `getRandomServer()` does not.

For example:

```
{
    "serverName" : "US-PROD-1",
    "serverAddress" : "192.168.1.10",
    "distance" : "0.00" # measured in miles
}
```

See `StupidSimple\Math\DistanceCalulator` for more information on how the algorithm works!

### Citations

[](#citations)

[https://en.wikipedia.org/wiki/Haversine\_formula](https://en.wikipedia.org/wiki/Haversine_formula)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

4

Last Release

552d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d70e4fe3376bd06084e8c01b3df4e0fbd4998d5ef720fa2940496c694ab6f219?d=identicon)[BigMark824](/maintainers/BigMark824)

---

Top Contributors

[![BigMark824](https://avatars.githubusercontent.com/u/77483822?v=4)](https://github.com/BigMark824 "BigMark824 (16 commits)")

### Embed Badge

![Health badge](/badges/mathmark-stupid-simple-matchmaking/health.svg)

```
[![Health](https://phpackages.com/badges/mathmark-stupid-simple-matchmaking/health.svg)](https://phpackages.com/packages/mathmark-stupid-simple-matchmaking)
```

###  Alternatives

[xiaobopang/pinyin

汉字转带有声调的汉语拼音，汉字转无声调的汉语拼音，汉字转成汉语拼音首字母

315.1k](/packages/xiaobopang-pinyin)

PHPackages © 2026

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