承接 xint0/wialon-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xint0/wialon-php

最新稳定版本:0.4.2

Composer 安装命令:

composer require xint0/wialon-php

包简介

PHP client for the Wialon API.

README 文档

README

Wialon API client.

Installation

Requirements

  • PHP 8.4 or later.
  • PSR-18 HTTP client implementation.

Install using Composer

Install with Guzzle 7 adapter:

composer require xint0/wialon-php php-http/guzzle7-adapter

If you already have a PSR-18 client in your project, you can install only the Wialon API client:

composer require xint0/wialon-php

How to use

Token authentication

First follow the instructions in the Wialon SDK documentation to obtain an authentication token.

Login to Wialon service

use Xint0\WialonPhp\Wialon;
use Xint0\WialonPhp\WialonException;

// You can specify a custom host.
$baseUri = 'https://hst-api.wialon.com';

$wialon = new Wialon($baseUri)

try {
    $token = 'your authentication token';
    $wialon->login($token);
    // After logging in to service a session ID is returned.
    $wialon->sessionId()
} catch (WialonException $exception) {
    // WialonException is thrown when request fails or service returns error response.
}

Logout

use Xint0\WialonPhp\Wialon;
use Xint0\WialonPhp\WialonException;

$token = 'token';

$wialon = new Wialon();

$wialon->login($token);
$wialon->logout();

$wialon->sessionId(); // Returns `null` after logging out.

Get unit by name

use Xint0\WialonPhp\Wialon;
use Xint0\WialonPhp\WialonException;

$token = 'token';

$wialon = new Wialon();

$wialon->login($token);

$data = $wialon->unitByName('Unit name'); // Returns associative array with response data.

Get location by coordinates

use Xint0\WialonPhp\Wialon;
use Xint0\WialonPhp\WialonException;

$token = 'token';

$wialon = new Wialon();

$wialon->login($token);

$longitude = -111.004287;
$latitude = 30.6141861;
$format = '32100';
$data = $wialon->getLocations($longitude, $latitude, $format); // Returns associative array with response data.

/*
$data == ["Magdalena, Sonora, Mexico"]
*/

License

The Wialon API client is open source software licensed under the MIT license.

统计信息

  • 总下载量: 5.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固