Download the PHP package matthiggins/bluezone without Composer

On this page you can find all versions of the php package matthiggins/bluezone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bluezone

bluezone-banner

BLUEZONE : A PHP SDK for the PUBG API

Version PHP Version Require License

BLUEZONE is a PHP SDK for the PUBG API. It covers players, matches, seasons, clans, ranked and lifetime stats, weapon and survival mastery, and it parses match telemetry files into typed event objects.

It is built on Saloon 4: every response is a data transfer object, and every Saloon feature (mocking, middleware, retries) is available.

Links: PUBG API · PUBG API docs · Saloon · Laravel Collections

Contents

Requirements

Installation

Creating a client

The constructor is:

$requestsPerMinute should match the quota on your key (10 for a standard key). Connect and request timeouts are 10s and 15s.

Rate limiting

Bluezone enforces your quota client-side with the Saloon rate limit plugin, so you fail fast instead of burning 429s.

The default store is Saloon's MemoryStore, which only tracks one process. In a queue worker, a web app, or anything else running more than one process at a time, pass a shared store:

LaravelCacheStore and FileStore work as well. Both the spent local budget and a 429 from the API raise Saloon\RateLimitPlugin\Exceptions\RateLimitReachedException; the 429 handler runs first, so Saloon's own TooManyRequestsException is not what you catch.

recentMatches() (and recentCasualMatches() / recentRankedMatches()) issues one request per match id, and rankedSeasonStatsMany() one per account id, so a default $limit of 20 spends twice a standard key's 10-per-minute budget: keep $limit under your per-minute budget, or pass the budget your key actually has.

Turn the plugin off in tests with $bluezone->useRateLimitPlugin(false).

Shards and game modes

Every resource method takes Bluezone\Enums\Shard or its string value, and Bluezone\Enums\GameMode or its string value.

Shards: steam, xbox, psn, kakao, console, tournament. Game modes: solo, solo-fpp, duo, duo-fpp, squad, squad-fpp.

Leaderboards are the one endpoint still keyed by platform-region, so they take Bluezone\Enums\Region (pc-eu, pc-na, pc-as, pc-sea, pc-kakao, …) instead of a shard.

Resources

Every method returns a typed DTO from Bluezone\Responses.

rankedSeasonStatsMany() is one request per account id: the PUBG API has no batch ranked endpoint.

Samples and leaderboards are metered against the rate limit; matches are not. A leaderboard row's kda and killDeathRatio are always 0 from the API, so LeaderboardPlayer leaves them out.

Exceptions

Bluezone throws Bluezone\Exceptions\BluezoneException subclasses for the cases the API reports as a bare 404:

Exception Thrown when
PlayerNotFoundException player()->find(), findMany(), search() or searchMany() gets a 404, or the search matched no player
MatchNotFoundException match()->find() gets a 404
LeaderboardNotFoundException leaderboard()->get() gets a 404: no board for that region, season and mode
InvalidSampleWindowException sample()->get() is given a start time more than 14 days back or in the future; thrown before any request is sent
InvalidTelemetryUrlException a telemetry url is not on telemetry-cdn.pubg.com
InvalidTelemetryException a telemetry body is not decodable JSON
Saloon\RateLimitPlugin\Exceptions\RateLimitReachedException the local budget is spent, or the API answered 429
ValueError Shard::resolve(), Region::resolve() or GameMode::resolve() is given a string that is not a shard, region or game mode

Everything else surfaces as a Saloon exception (UnauthorizedException, ServiceUnavailableException, FatalRequestException, …). See Saloon — handling failures.

Match telemetry

Telemetry files are gzipped JSON on a public CDN, typically 5-15 MB, and are downloaded by a separate connector that carries no API key and does not count against your rate limit.

Use download() instead when you want the bytes rather than the objects. It returns the compressed body as a PSR-7 StreamInterface and decodes nothing:

Telemetry events

Events whose _T has no class are skipped rather than failing the parse, and counted by unmappedTypes().

Player events

Match events

Filtering events

events() is a Laravel Collection, so filter it however you like:

Testing

Bluezone is a Saloon connector, so mock it with Saloon's MockClient:

Telemetry downloads go through a second connector (TelemetryConnector), which a MockClient attached to the Bluezone instance does not reach; use MockClient::global([...]) to mock them.

This package's own suite replays recorded responses:

To re-record a fixture, delete the file and run the recording test with a real key:

Run the checks with composer check (Pint, PHPStan level 5, Pest).


All versions of bluezone with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/collections Version ^12.0 || ^13.0
nesbot/carbon Version ^3.0
saloonphp/rate-limit-plugin Version ^2.5
saloonphp/saloon Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package matthiggins/bluezone contains the following files

Loading the files please wait ...