API wrapper for Synology Router Manager (SRM).
- get WAN status,
- get network utilization,
- get devices with status, IP, etc... ,
- get wifi devices with link quality, signal strength, max rate, band used, etc... ,
- get devices traffic usage (live, day, week, month),
- get mesh nodes with status, connected devices, etc... ,
- get wake-on-lan devices,
- get access control groups with devices, online status, etc... ,
- add wake-on-lan on a device,
- wake-on-lan a device.
To install with composer:
composer require nioc/synology-srm-php-api
Or download latest release zip archive,
$client = new SrmClient(null, $username, $password, $hostname, $port, $https, false);
If you can store session id, you can pass it value to constructor. if value is null
, client will execute a login request.
$client = new SrmClient(null, $username, $password, $hostname, $port, $https, true, $sid);
To retrieve session id value in order to store it:
$sid = $client->getSid();
Constructor first parameter is LoggerInterface
, allowing you to use any PSR-3 compliant logger library (like Monolog or Analog).
Following a basic console logger with Analog:
use Analog\Logger;
use Analog\Handler\EchoConsole;
$logger = new Logger;
Analog::$format = "%s - %s - %s - %s\n";
$logger->handler(
Analog\Handler\Threshold::init(
Analog\Handler\LevelName::init(
EchoConsole::init()
),
Analog::INFO
)
);
$client = new SrmClient($logger, $username, $password, $hostname, $port, $https, true, $sid);
Simply call the requested client method, exemple with traffic:
$devicesTraffic = $client->getTraffic('live');
You can see a full exemple here.
This library is maintained under the semantic versioning guidelines.
See the releases on this repository for changelog.
If you have a suggestion, please submit a feature request. Pull requests are welcomed.
- Nioc - Initial work
See also the list of contributors to this project.
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details