ocolin / tachyon-lite
HTTP client for Tachyon Networks devices running 8devices firmware, providing MAC table and status data without a dedicated API
Requires
- php: ^8.4
- guzzlehttp/guzzle: ^7.10
- ocolin/global-type: ^2.0
Requires (Dev)
- ocolin/easyenv: ^3.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.1
README
A PHP HTTP client for Tachyon Networks devices running 8devices firmware. Provides access to MAC table and device status data on models that lack a dedicated API, such as the TNS-100.
Tachyon Networks offers a dedicated API on their higher-end devices. TachyonLite is designed for models where that API is unavailable, providing equivalent read access to MAC table and status data through the device's web interface.
Compatible Devices
This client communicates with the web interface of devices running 8devices firmware. It has been tested against the Tachyon Networks TNS-100. Other devices running 8devices firmware may also be compatible.
Requirements
- PHP 8.4+
- Guzzle 7.10+
- ocolin/global-type 2.0+
Installation
composer require ocolin/tachyon-lite
Configuration
Configuration can be provided directly or via environment variables. Direct arguments take priority over environment variables.
Via Constructor
use Ocolin\TachyonLite\Config; use Ocolin\TachyonLite\TachyonLite; $client = new TachyonLite( config: new Config( host: '10.0.0.1', username: 'admin', password: 'secret', ));
Via Environment Variables
TACHYON_LITE_HOST=10.0.0.1 TACHYON_LITE_USERNAME=admin TACHYON_LITE_PASSWORD=secret TACHYON_LITE_SSL=true TACHYON_LITE_HTTP_PORT=80 TACHYON_LITE_HTTPS_PORT=443
When environment variables are set, no arguments are needed:
$client = new TachyonLite();
Config Options
| Parameter | Type | Default | ENV Variable | Description |
|---|---|---|---|---|
| host | string | — | TACHYON_LITE_HOST | IP address or hostname |
| username | string | — | TACHYON_LITE_USERNAME | Login username |
| password | string | — | TACHYON_LITE_PASSWORD | Login password |
| ssl | bool | true | TACHYON_LITE_SSL | Use HTTPS |
| httpPort | int | 80 | TACHYON_LITE_HTTP_PORT | HTTP port |
| httpsPort | int | 443 | TACHYON_LITE_HTTPS_PORT | HTTPS port |
| options | array | [] | — | Additional Guzzle options |
Usage
MAC Table
Returns an array of MacEntry objects representing the device's MAC forwarding table.
$entries = $client->getMacTable(); foreach( $entries as $entry ) { echo $entry->mac . PHP_EOL; // f4:1e:57:8f:58:6a echo $entry->interface . PHP_EOL; // eth5 echo $entry->vlan . PHP_EOL; // 1 echo $entry->bridge . PHP_EOL; // br-wan echo $entry->offload . PHP_EOL; // true }
MacEntry Properties
| Property | Type | Description |
|---|---|---|
| mac | string | MAC address |
| interface | string | Network interface (e.g. eth1, eth5) |
| vlan | int | VLAN ID, 0 if not present |
| bridge | string | Bridge name, empty if not present |
| offload | bool | Whether hardware offload is active |
Device Status
Returns a Status object containing device information. All properties are raw decoded JSON objects.
$status = $client->getStatus(); echo $status->system->model; // TNS-100 echo $status->system->fw_version; // 1.0.0 echo $status->network->hostname; // my-device
By default all available types are returned. You can request specific types:
$status = $client->getStatus( types: ['system', 'network'] );
Available Status Types
| Type | Description |
|---|---|
| system | Model, serial number, firmware, CPU, memory |
| network | Hostname, DNS, DHCP, zone/IP information |
| interfaces | Per-interface details including port descriptions |
| ethernet | Ethernet port statistics (hardware dependent) |
Exceptions
| Exception | Description |
|---|---|
| ConfigException | Required configuration missing |
| AuthException | Authentication failed |
| TachyonLiteException | Unexpected response from device |
| GuzzleException | HTTP transport error |
License
MIT