gissilali / chirpstack-api-hydroiq

ChirpStack PHP API

dev-master 2024-07-30 08:47 UTC

This package is auto-updated.

Last update: 2024-09-30 09:14:30 UTC


README

ChirpStack gRPC API 的 PHP 消息和服务包装器。

安装

使用 composer

composer require chirpstack/chirpstack-api

使用方法

所有消息、服务、常量等都是自动从 ChirpStack protobuf 定义生成的。结果是,该包结构符合 protobuf 定义的结构。

protobuf 定义可在此处找到: https://github.com/chirpstack/chirpstack/tree/master/api/proto

示例

<?php

namespace Test;

use Chirpstack\API\ApplicationServiceClient;
use Chirpstack\API\ListApplicationsRequest;
use Grpc\Channel;
use Grpc\ChannelCredentials;

require dirname(__FILE__) . '/vendor/autoload.php';

function main() {
    $channel = new Channel('url',  ['credentials' => ChannelCredentials::createInsecure()]);
    $client = new ApplicationServiceClient('url', [], $channel);
    $request = new ListApplicationsRequest();
    $response = $client->List($request);
    $data = $response->wait();
    print_r($data);
}

main();