Via composer:
composer require jjsquady/mikrotikapi
Or manually insert this block into your composer.json in require section:
"require": {
"jjsquady/mikrotikapi": "dev-master", // <- this line
}
Insert into app/config.php
in providers
array:
jjsquady\MikrotikApi\MikrotikServiceProvider::class
Insert into app/config.php
in facades
array:
'Mikrokit' => jjsquady\MikrotikApi\Facades\MikrotikFacade::class
// create a connection with Mikrotik Router
$conn = Mikrokit::connect(['<host_ip>', '<username', '<password>']);
if($conn->isConnected()) {
// you have access to Commands
// and can call from here...
}
$conn = Mikrokit::connect(['<host_ip>', '<username', '<password>']);
if($conn->isConnected()) {
$iComm = new InterfaceCommand($conn);
$interfaces = $iComm->all() // returns all interfaces as array
//
$interfaces = $iComm->get() // returns all interfaces as InterfaceEntity Object
// you can send it to view
return view("<some_view>", [
'interfaces' => $interfaces
]);
}