定制 michalkortas/sms-gate-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

michalkortas/sms-gate-api

最新稳定版本:v1.0.0

Composer 安装命令:

composer require michalkortas/sms-gate-api

包简介

API For huawei LAN/WAN LTE Modems written in PHP

README 文档

README

API for Huawei LAN/WAN LTE Modems rewritten from original Python library into PHP you can use this to simply send SMS, get information about your internet usage, signal, and tons of other stuff

Tested on:

3G/LTE Routers:

  • Huawei B310s-22
  • Huawei B315s-22
  • Huawei B525s-23a
  • Huawei B525s-65a
  • Huawei B715s-23c
  • Huawei B528s
  • Huawei B535-232
  • Huawei B628-265
  • Huawei B818-263
  • Huawei E5186s-22a
  • Huawei E5576-320
  • Huawei E5577Cs-321

3G/LTE USB sticks:

(Device must support NETWork mode aka. "HiLink" version, it wont work with serial mode)

  • Huawei E3131
  • Huawei E3372
  • Huawei E3531

5G Routers:

  • Huawei 5G CPE Pro 2 (H122-373)

(probably will work for other Huawei LTE devices too)

Will NOT work on:

LTE Routers:

  • Huawei B2368-22 (Incompatible firmware, testing device needed!)
  • Huawei B593s-22 (Incompatible firmware, testing device needed!)

Installation

composer

$ composer require icetee/huawei-lte-api-php

Usage

<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use Icetee\HuaweiAPI\Connection;
use Icetee\HuaweiAPI\Options\ConnectionOptions;
use Icetee\HuaweiAPI\Endpoints\Sms;

$connectionOptions = new ConnectionOptions();
$connectionOptions->setUrl('http://192.168.8.1');
$connectionOptions->setUsername('admin');
$connectionOptions->setPassword('YOUR_PASSWORD');

$connection = new Connection($connectionOptions);

$device = new Device($connection);

echo json_encode($device->information());

Send SMS

<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use Icetee\HuaweiAPI\Connection;
use Icetee\HuaweiAPI\Enums\ApiResponseEnum;
use Icetee\HuaweiAPI\Options\ConnectionOptions;
use Icetee\HuaweiAPI\Endpoints\Sms;

$connectionOptions = new ConnectionOptions();
$connectionOptions->setUrl('http://192.168.8.1');
$connectionOptions->setUsername('admin');
$connectionOptions->setPassword('admin');

$connection = new Connection($connectionOptions);

$sms = new Sms($connection);

$response = $sms->sendSms(['+48123456789'], 'message');

if ($response->getXmlContent()->__toString() === ApiResponseEnum::OK->value) {
    echo "Success";
} else {
    echo "Error";
}

Get SMS list

<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use Icetee\HuaweiAPI\Connection;
use Icetee\HuaweiAPI\Options\ConnectionOptions;
use Icetee\HuaweiAPI\Endpoints\Sms;

$connectionOptions = new ConnectionOptions();
$connectionOptions->setUrl('http://192.168.8.1');
$connectionOptions->setUsername('admin');
$connectionOptions->setPassword('admin');

$connection = new Connection($connectionOptions);

$sms = new Sms($connection);

$response = $sms->getSmsList();

$inbox = $response->getXmlContent();

var_dump($inbox);

Use with Docker (BETA)

NOTICE: It is in development. Simple calls have been resolved for now. Complex parameters such as DateTime, Enum are not resolved.

The entry point for the docker is the docker/api.php file. The first parameter is the name of the class. The second parameter is the method name of the class. Everything else is a parameter of the method.

docker run --env HUAWEI_API_PASSWORD=__PASSWORD__ --rm icetee/huawei-lte-api-php:latest Endpoints\Device informations

Examples:

  • Endpoints\Device informations
  • Config\Device config
  • Endpoints\Sms sendSms 'a[]=+420123456788' "Hello World!"
  • Endpoints\Sms sendSms 'a[]=+420123456788&a[]=+420123456789' "Hello World! Multi phone number."

Develop

docker build -f Dockerfile.dev --tag huawei-lte-api-php:latest .
docker run -it --rm -v $(pwd):/app huawei-lte-api-php:latest sh

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2022-12-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固