PHP code example of matthiggins / bluezone

1. Go to this page and download the library: Download matthiggins/bluezone library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

matthiggins / bluezone example snippets


use Bluezone\Bluezone;

$bluezone = new Bluezone($apiKey);

// Search for a player
$player = $bluezone->player()->search($shard, $playerName);

// Find a player by account ID
$player = $bluezone->player()->find($shard, $accountId);



use Saloon\Exceptions\SaloonException;

try {
    $seasons = $bluezone->season()->all('fail');
}catch(SaloonException $e) {
    $status = $e->getStatus();
}


// Get all PUBG seasons
$seasons = $bluezone->season()->all($shard);


// Find a specific player using the account id
$player = $bluezone->player()->find($shard, $accountId);

// Search for a player by name 
// NOTE : player search layerName02]);

// Season stats for a single player
$seasonStats = $bluezone->player()->seasonStats($shard, $season, $accountId);

// Season stats for up to 10 players
$seasonStats = $bluezone->player()->seasonStatsMany($shard, $season, $gameMode, [$accountId,$accountId]);

// Ranked season stats for a single player
$rankedSeasonStats = $bluezone->player()->rankedSeasonStats($shard, $season, $accountId);

// Lifetime season stats for a single player
$lifetimeStats = $bluezone->player()->lifetimeStats($shard, $accountId);

// Lifetime stats for up to 10 players
$lifetimeStats = $bluezone->player()->lifetimeStatsMany($shard, $gameMode, [$accountId,$accountId]);

// Get weapon mastery for a single player
$weaponMastery = $bluezone->player()->weaponMastery($shard, $accountId);

// Get survival mastery for a single player
$survivalMastery = $bluezone->player()->survivalMastery($shard, $accountId);

// Get a match
$match = $bluezone->match()->find($shard, $matchId);

// Get a single match DTO instance
$match = $bluezone->match()->find($shard, $matchId);

// Get the telemetry DTO instance
$telemetry = $match->getTelemetry();

// Get the raw telemetry events in a Collection
$rawEvents = $telemetry->raw();

// Alternatively you can map all telemetry 
// events to their DTO instances
$events = $telemetry->events();   


// Get all telemetry events for a specific player
$telemetry->player($accountId)->all();

// Get all attack events for a specific player
$telemetry->player($accountId)->attackEvents();

// Get all heal events for a specific player
$telemetry->player($accountId)->healEvents();

// Get all item attachment events for a specific player
$telemetry->player($accountId)->itemAttachEvents();

// Get all item detachment events for a specific player
$telemetry->player($accountId)->itemDetachEvents();

// Get all item drop events for a specific player
$telemetry->player($accountId)->itemDropEvents();

// Get all item equip events for a specific player
$telemetry->player($accountId)->itemEquipEvents();

// Get all item pickup events for a specific player
$telemetry->player($accountId)->itemPickupEvents();

// Get all item unequip events for a specific player
$telemetry->player($accountId)->itemUnequipEvents();

// Get all item use events for a specific player
$telemetry->player($accountId)->itemUseEvents();

// Get all kill events for a specific player
$telemetry->player($accountId)->killEvents();

// Get all object destroy events for a specific player
$telemetry->player($accountId)->objectDestroyEvents();

// Get all object interaction events for a specific player
$telemetry->player($accountId)->objectInteractionEvents();

// Get all parachute landing events for a specific player
$telemetry->player($accountId)->parachuteLandingEvents();

// Get all position events for a specific player
$telemetry->player($accountId)->positionEvents();

// Get all take damage events for a specific player
$telemetry->player($accountId)->takeDamageEvents();

// Get all throwable use events for a specific player
$telemetry->player($accountId)->useThrowableEvents();

// Get all swim events for a specific player
$telemetry->player($accountId)->swimEvents();

// Get all swim start events for a specific player
$telemetry->player($accountId)->swimStartEvents();

// Get all swim end events for a specific player
$telemetry->player($accountId)->swimEndEvents();

// Get all vault events for a specific player
$telemetry->player($accountId)->vaultEvents();

// Get all vehicle events for a specific player
$telemetry->player($accountId)->vehicleEvents();

// Get all weapon fire count events for a specific player
$telemetry->player($accountId)->weaponFireCountEvents();

// Get all wheel destroy events for a specific player
$telemetry->player($accountId)->wheelDestroyEvents();

// Get all care package events from the telemetry
$telemetry->match()->carePackageEvents();

// Get the definition of the match
$telemetry->match()->definition();

// Get the end state of the match
$telemetry->match()->end();

// Get all phase change events for the match
$telemetry->match()->phaseChanges();

// Get the start state of the match
$telemetry->match()->start();

// Get all state events from the match
$telemetry->match()->stateEvents();

use Bluezone\Telemetry\Events\PlayerAttack;

$playerAttackEvents = $telemetry->events()->filter(function ($event) use ($accountId) {
    return ($event instanceof PlayerAttack) && $event->attacker->accountId == $accountId;
});