PHP code example of xudongyss / tencentcloud-im-sdk-php

1. Go to this page and download the library: Download xudongyss/tencentcloud-im-sdk-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/ */

    

xudongyss / tencentcloud-im-sdk-php example snippets



fig = new Configuration();
//TODO: 此处替换成您的SDKAppID,应用 SDKAppID,可在即时通信 IM 控制台(https://console.cloud.tencent.com/im) 的应用卡片中获取。
$config->setSdkappid(123456789);
//TODO: 此处替换成您的identifier;用户名,调用 REST API时必须为App管理员帐号 参考:https://cloud.tencent.com/document/product/269/31999#app-.E7.AE.A1.E7.90.86.E5.91.98
$config->setIdentifier("identifier");
//TODO: 此处替换成您的key, 参考:https://cloud.tencent.com/document/product/269/32688#getkey
$config->setKey("key");

$apiInstance = new TencentCloud\IM\Api\AccountApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(), $config
);
$random = 56; // int | 
$accountCheckRequest = new \TencentCloud\IM\Model\AccountCheckRequest(); // \TencentCloud\IM\Model\AccountCheckRequest | 
 //TODO: Set the request parameters

try {
    $result = $apiInstance->accountCheck($random, $accountCheckRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountCheck: ', $e->getMessage(), PHP_EOL;
}