PHPackages                             ptrtn/battlerite - 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. [API Development](/categories/api)
4. /
5. ptrtn/battlerite

ActiveLibrary[API Development](/categories/api)

ptrtn/battlerite
================

A php-based client wrapping the battlerite API

v1.7(8y ago)151MITPHP

Since Dec 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/PtrTn/battlerite-sdk)[ Packagist](https://packagist.org/packages/ptrtn/battlerite)[ RSS](/packages/ptrtn-battlerite/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (7)Versions (13)Used By (0)

Battlerite-sdk
==============

[](#battlerite-sdk)

PHP-based SDK for Battlerite API

[![Build Status](https://camo.githubusercontent.com/59d30b549539af7ee8fb81cd98579941044a2f4eea873b4d99d929cba52aa841/68747470733a2f2f7472617669732d63692e6f72672f507472546e2f626174746c65726974652d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PtrTn/battlerite-sdk)[![Code Coverage](https://camo.githubusercontent.com/5f182cd758c35f812b0fa174c89b4d0f5ae17c2d11c1605ba87595645c589ac1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f507472546e2f626174746c65726974652d73646b2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PtrTn/battlerite-sdk/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2f0b1cdf815640e0ceffce4b19d13af33930bbd74951aab9a5550d6b5c3735e6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f507472546e2f626174746c65726974652d73646b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PtrTn/battlerite-sdk/?branch=master)

Features
--------

[](#features)

- Retrieve data for matches (by query)
- Retrieve detailed data for a specific match
- Retrieve data for players (by query)
- Retrieve detailed data for a specific player
- Retrieve team data for specific players and seasons
- Retrieve api status

Requirements
------------

[](#requirements)

- Php 7.1 or higher

Installing
----------

[](#installing)

`composer require ptrtn/battlerite-sdk`

Usage
-----

[](#usage)

Retrieving data can be as simple as one method call. If no search query is specified, API defaults are used instead.

### Api status

[](#api-status)

The following example returns API status, patch version and other data

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$status = $client->getStatus();
```

### Retrieving match data

[](#retrieving-match-data)

Retrieving match data using API defaults

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$matches = $client->getMatches();
echo $matches[0]->map->type;
// QUICK2V2
```

### Retrieving team data

[](#retrieving-team-data)

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$teams = $client->getTeams(
    TeamsQuery::create()
    ->forPlayerIds(['322'])
    ->forSeason(5)
);
```

### Retrieving detailed match data

[](#retrieving-detailed-match-data)

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$match = $client->getMatch('AB9C81FABFD748C8A7EC545AA6AF97CC');
```

### Retrieving detailed player data

[](#retrieving-detailed-player-data)

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$match = $client->getPlayer('934791968557563904');
```

### Custom querying

[](#custom-querying)

A custom search query can be used to retrieve the exact data needed.

#### Matches

[](#matches)

For matches the following query options are available:

- Offset
- Limit
- Start date
- End date
- Player ids
- Team names
- Game modes
- Ascending sorting
- Descending sorting

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
// Retrieve matches for a specific player for the last 24 hours
$matches = $client->getMatches(
    MatchesQuery::create()
    ->forPlayerIds(['934791968557563904'])
    ->withStartDate(new DateTime('-1 day'))
);
```

#### Players

[](#players)

For players the following query options are available:

- Player name
- Steam id
- Player id

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
// Retrieve a list of players for a specific player name
$players = $client->getPlayers(
    PlayersQuery::create()
    ->forPlayerNames(['PlakkeStrasser'])
);
```

*Note: up to 6 players (1 per region) can be found for a specific player name.*

#### Teams

[](#teams)

For teams the following query options are available:

- Season
- Player id

```
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$teams = $client->getTeams(
    TeamsQuery::create()
    ->forPlayerIds(['322'])
    ->forSeason(5)
);
```

Caching
-------

[](#caching)

When sending a lot of requests, the default rate limit of 10 requests per minute will pose an issue. In order to prevent this, caching can be enabled for the player details and match details endpoints.

```
// Create client using default filesystem cache
$client = ClientWithCache::create('your-api-key');
```

Optionally an alternative cache lifetime or caching system implementing the `Doctrine\Common\Cache\Cache` interface can be configured.

```
// Create a client using custom configured cache
$client = ClientWithCache::createWithCache(
    'your-api-key',
    new RedisCache(),
    300
);
```

How do I get an API key?
------------------------

[](#how-do-i-get-an-api-key)

1. In order to get an API key you should [create a developer account and an app](https://developer.battlerite.com/users/sign_in)
2. Once created, log in and browse to
3. Scroll down to **DEVELOPMENT API KEY THIS APP USES**, it should look like: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9G9lIiwiYWRtaW4iOnRydWV9G9lIi.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ`

Api documentation
-----------------

[](#api-documentation)

Documentation for the Battlerite API can be found at

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

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

Total

10

Last Release

3057d ago

### Community

Maintainers

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

---

Top Contributors

[![PtrTn](https://avatars.githubusercontent.com/u/8270784?v=4)](https://github.com/PtrTn "PtrTn (146 commits)")

---

Tags

apiapi-clientapi-wrapperbattleritebattlerite-apisdk

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ptrtn-battlerite/health.svg)

```
[![Health](https://phpackages.com/badges/ptrtn-battlerite/health.svg)](https://phpackages.com/packages/ptrtn-battlerite)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)[linkstreet/box-sdk

v2 Box sdk for php

121.3k](/packages/linkstreet-box-sdk)

PHPackages © 2026

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