PHP code example of philicevic / faceit-php

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

    

philicevic / faceit-php example snippets


use Philicevic\FaceitPhp\Faceit;

$faceit = new Faceit($_ENV['FACEIT_API_TOKEN']);

// Look up a player by nickname
$player = $faceit->player()->lookup(nickname: 's1mple');

echo $player->nickname;
echo $player->country;
echo $player->games['cs2']->faceitElo;

// Get match details
$match = $faceit->match()->get('1-bb13fd78-e183-4d37-8a4b-ceed67da5265');

foreach ($match->teams as $team) {
    echo $team->name;
}
bash
composer