PHP code example of dant89 / smite-api-php-client

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

    

dant89 / smite-api-php-client example snippets


use Dant89\SmiteApiClient\Client;

// Create base client
$smiteClient = new Client(SMITE_DEV_ID, SMITE_AUTH_KEY);

// Get a session_id from a signed authentication request
$authClient = $smiteClient->getHttpClient('auth');
$timestamp = date('omdHis');
$response = $authClient->createSession($timestamp);

// Check for valid response status
if ($response->getStatus() === 200) {
    $sessionId = $response->getContent()['session_id'];
}

$clanId = 123;

$teamClient = $smiteClient->getHttpClient('team');
$response = $teamClient->getTeamPlayers($clanId, $sessionId, $timestamp);

$teamPlayers = [];
if ($response->getStatus() === 200) {
    $teamPlayers = $response->getContent();
}
json
""dant89/smite-api-php-client": REPLACE_WITH_VERSION
}