meklis / switcher-core-client
Client for switcher-core-api
1.0
2021-09-18 22:38 UTC
Requires
- php: >=7.2.0
- ext-curl: *
- ext-json: *
- php-curl-class/php-curl-class: dev-master
This package is auto-updated.
Last update: 2024-11-16 08:58:43 UTC
README
Client for working with switcher-core-api on PHP
Installation
From composer
composer require meklis/switcher-core-client
Usage
- Detect device
<?php require __DIR__ . '/../vendor/autoload.php'; $device = (new \Meklis\SwCoreClient\Objects\Device()) ->setIp("10.1.1.11") ->setCommunity("public"); $client = new \Meklis\SwCoreClient\Client(); $resp = $client->detectByDevice($device);
- Call
<?php require __DIR__ . '/../vendor/autoload.php'; $client = new \Meklis\SwCoreClient\Client(); $req = \Meklis\SwCoreClient\Objects\Request::init( (new \Meklis\SwCoreClient\Objects\Device())->setIp('10.1.1.11')->setCommunity('public'), "system" ); $resp = $client->call($req);
- MultiCall
<?php require __DIR__ . '/../vendor/autoload.php'; $client = new \Meklis\SwCoreClient\Client(); $reqs = [ \Meklis\SwCoreClient\Objects\Request::init( (new \Meklis\SwCoreClient\Objects\Device())->setIp('10.1.1.11')->setCommunity('public'), "system" ), \Meklis\SwCoreClient\Objects\Request::init( (new \Meklis\SwCoreClient\Objects\Device())->setIp('10.1.1.11')->setCommunity('public'), "fdb", ['interface' => 27] ), ]; $resp = $client->callMulti($reqs); print_r($resp);
See more in examples directory