PHP code example of r6api / client

1. Go to this page and download the library: Download r6api/client 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/ */

    

r6api / client example snippets






use R6API\Client\ClientBuilder;
use R6API\Client\Api\Type\PlatformType;

$builder = new ClientBuilder();
$builder->setCacheItemPool($cacheItemPool); // accept PSR-6 adapter (not mandatory)
$client = $builder->buildAuthenticated('%email%', '%password%');

$profiles = $client->getProfileApi()->get(PlatformType::PC, 'panda_______');

class Profile
{
    /**
     * @var \Ramsey\Uuid\Uuid
     */
    public $profileId;

    /**
     * @var \Ramsey\Uuid\Uuid
     */
    public $userId;

    /**
     * @var string
     * @see \R6API\Client\Api\Type\PlatformType
     */
    public $platformType;

    /**
     * @var \Ramsey\Uuid\Uuid
     */
    public $idOnPlatform;

    /**
     * @var string
     */
    public $nameOnPlatform;
}


$progressions = $client->getProgressionApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527']);

class Progression
{
    /**
     * @var int
     */
    public $xp;

    /**
     * @var Uuid
     */
    public $profileId;

    /**
     * @var int
     */
    public $lootboxProbability;

    /**
     * @var int
     */
    public $level;

    public function getLootboxProbabilityPercent(): float;
}

$response = $client->getRankApi()->get(PlatformType::PC, RegionType::EUROPE, SeasonType::CURRENT, ['575b8c76-a33a-4c19-9618-d14b9343d527']);

class Rank
{
    /**
     * @var string
     */
    public $boardId;

    /**
     * @var int
     */
    public $pastSeasonsAbandons;

    /**
     * @var \DateTime
     */
    public $updateTime;

    /**
     * @var float
     */
    public $skillMean;

    /**
     * @var int
     */
    public $abandons;

    /**
     * @var int
     */
    public $season;

    /**
     * @var string
     */
    public $region;

    /**
     * @var Uuid
     */
    public $profileId;

    /**
     * @var int
     */
    public $pastSeasonsLosses;

    /**
     * @var float
     */
    public $maxMmr;

    /**
     * @var float
     */
    public $mmr;

    /**
     * @var int
     */
    public $wins;

    /**
     * @var float
     */
    public $skillStdev;

    /**
     * @var int
     */
    public $rank;

    /**
     * @var int
     */
    public $losses;

    /**
     * @var int
     */
    public $nextRankMmr;

    /**
     * @var int
     */
    public $pastSeasonsWins;

    /**
     * @var int
     */
    public $previousRankMmr;

    /**
     * @var int
     */
    public $maxRank;

    public function getWinLosseRate(): float;
}

$statistics = [
    StatisticType::CASUAL_TIMEPLAYED,
    StatisticType::CASUAL_MATCHPLAYED,
    StatisticType::CASUAL_MATCHWON,
    StatisticType::CASUAL_MATCHLOSTS,
    StatisticType::CASUAL_KILLS,
    StatisticType::CASUAL_DEATH
];

$response = $client->getStatisticApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527'], $statistics);