sagleft/utopialib-php

Utopia网络API的PHP库

1.0.25 2021-04-08 10:50 UTC

README

logo

Utopia网络API的PHP库。

使用Composer安装

composer require sagleft/utopialib-php

用法

$token = "3D4F4A5E34706378B4A4541502E603B6";
$client = new UtopiaLib\Client($token, "http://127.0.0.1", 22824);
print_r($client->getSystemInfo());

结果

Array
(
    [result] => Array
        (
            [buildAbi] => x86_64-little_endian-llp64
            [buildCpuArchitecture] => x86_64
            [build_number] => 0.3.5115
            [currentCpuArchitecture] => x86_64
            [netCoreRate] => 25
            [networkCores] => 1
            [networkEnabled] => 1
            [numberOfConnections] => 9
            [packetCacheSize] => 7320
            [uptime] => 02:30:09
        )

    [resultExtraInfo] => Array
        (
            [elapsed] => 0
        )

)

如何运行示例

cp example.env .env

然后在 .env 中输入您的数据以连接到客户端。然后打开 examples 文件夹。

示例(命令行)

php CheckConnection.php

您可以在主类接口中找到关于所有方法的信息 这里。

为了方便,库中所有方法都与Utopia API中的方法同名。

额外方法

  • checkClientConnection(): bool;
  • isUserMyContact($pkOrNick): bool;
  • getNetworkSummary(): array;
  • isCryptonEngineReady(): bool;
  • isNATDetectionON(): bool;
  • isUPNPDetectionON(): bool;
  • isChannelDatabaseReady(): bool;
  • getChannelDecription($channelid): string;
  • getChannelOwnerPubkey($channelid): string;
  • getChannelTitle($channelid): string;
  • getChannelType($channelid): string;
  • getNetworkChannelsCount(): int;
  • getTotalChannelsCount(): int;
  • getLastDownloadedChannelTitle(): string;
  • getMyPubkey(): string;
  • getMyNick(): string;
  • getMyAvatarHash(): string;
  • isPOSenabled(): bool;
  • findChannelsByPubkey($pubkey): array;
  • isNetworkEnabled(): bool;

许可

UtopiaLib是在MIT许可下授权的。

image

🌐 Telegram频道