sendbird/sendbird-platform-sdk-php

Sendbird 平台 API SDK https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api

1.0.16 2022-11-16 12:55 UTC

This package is not auto-updated.

Last update: 2024-09-16 19:46:16 UTC


README

Sendbird banner image

Sendbird PHP 平台 SDK

link to docs 这是一个为 PHP 编写的 SDK,使与 Sendbird 平台 API 通信更加容易。使用这个库,您可以将 Sendbird 集成扩展到包括消息和频道自动化、用户管理、创建用户身份验证令牌和创建机器人等高级功能。

🔥 快速开始

<?php
require_once('/PATH_TO/sendbird-platform-sdk-php/vendor/autoload.php');
$config = \Sendbird\Configuration::getDefaultConfiguration();

$api_token = 'MASTER_API_TOKEN_FROM_DASHBOARD';
$config->setHost("API_REQUEST_URL_FROM_DASHBOARD");

$apiInstance = new Sendbird\Api\UserApi(
    new GuzzleHttp\Client(),
    $config
);

$list_users_params['api_token'] = $api_token;

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

⚠️ 注意

该软件包目前未发布。请参阅本地开发部分获取安装说明。

⚒️ 前提条件

为了使用此 SDK 发送请求,您需要您的主 API 令牌。这可以通过 Sendbird 控制台 获取。在 Sendbird 中创建的每个应用程序都有自己的主 API 令牌。这些令牌可以在“设置”>“应用程序”>“常规”中找到。 how to find you api token

💻 要求

您需要安装 PHP。此 SDK 已在 PHP 7.3 及更高版本上进行开发和测试。

Composer

要使用 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/sendbird/sendbird-platform-sdk-php.git"
    }
  ],
  "require": {
    "sendbird/sendbird-platform-sdk-php": "*@dev"
  }
}

然后运行 composer install

手动安装

  1. 克隆此存储库,在 sendbird-platform-sdk 目录中运行 composer install
  2. 在您的项目中包含 autoload.php
<?php
require_once('/path/to/sendbird-platform-sdk/vendor/autoload.php');
有用的链接