Browse Source

docs updated

tags/0.6 0.6
Paul Rock 7 years ago
parent
commit
4dcdcf8cb1
  1. 38
      README.md
  2. 16
      examples/ip_address_print.php

38
README.md

@ -35,15 +35,12 @@ use \RouterOS\Config;
use \RouterOS\Client;
use \RouterOS\Query;
// Create object of class and set parameters
$config =
(new Config())
->set('host', '192.168.1.3')
->set('user', 'admin')
->set('pass', 'admin');
// Initiate client with config object
$client = new Client($config);
$client = new Client([
'host' => '192.168.1.3',
'user' => 'admin',
'pass' => 'admin'
]);
// Build query
$query = new Query('/ip/address/print');
@ -61,6 +58,10 @@ You can simplify your code and send then read from socket in one line:
```php
$response = $client->write($query)->read();
var_dump($response);
// Single method analog of line above is
$response = $client->wr($query);
var_dump($response);
```
By the way, you can send few queries to your router without result:
@ -75,6 +76,13 @@ $client->write($query1)->write($query2)->write($query3);
// Enable config class
use \RouterOS\Config;
// Create object of config class in one call
$config = new Config([
'host' => '192.168.1.3',
'user' => 'admin',
'pass' => 'admin'
]);
// Create object of class
$config = new Config();
@ -90,6 +98,20 @@ $config
->set('pass', 'admin');
```
Or you can just create preconfigured client object with all
required settings:
```php
// Enable config class
use \RouterOS\Client;
$client = new Client([
'host' => '192.168.1.3',
'user' => 'admin',
'pass' => 'admin'
]);
```
#### List of available configuration parameters
| Parameter | Type | Default | Description |

16
examples/ip_address_print.php

@ -3,20 +3,16 @@ require_once __DIR__ . '/../vendor/autoload.php';
error_reporting(E_ALL);
use \RouterOS\Config;
use \RouterOS\Client;
use \RouterOS\Query;
// Create config object with parameters
$config =
(new Config())
->set('timeout', 1)
->set('host', '127.0.0.1')
->set('user', 'admin')
->set('pass', 'admin');
// Initiate client with config object
$client = new Client($config);
$client = new Client([
'timeout' => 1,
'host' => '127.0.0.1',
'user' => 'admin',
'pass' => 'admin'
]);
// Build query
$query = new Query('/ip/address/print');

Loading…
Cancel
Save