icetee / huawei-lte-api-php

API For huawei LAN/WAN LTE Modems written in PHP
10 stars 3 forks source link

huawei-lte-api-php

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:

3G/LTE USB sticks:

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

5G Routers:

(probably will work for other Huawei LTE devices too)

Will NOT work on:

LTE Routers:

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());

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:

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