anovob/mikrotik-api

Mikrotik API PHP 库,用于与 RouterOS API 交互

dev-master 2018-07-04 00:00 UTC

This package is auto-updated.

Last update: 2024-09-18 14:40:52 UTC


README

安装

通过 composer

composer require anovob/mikrotik-api

或者手动将以下块插入到你的 composer.json 的 require 部分

"require": {
    "anovob/mikrotik-api": "dev-master", // <- this line
}

基本用法

use MikrotikAPI\Roar\Roar;

// create a connection with Mikrotik Router

$conn = Roar::create(['host_ip', 'port', 'username', 'password']);
 
if($conn->isConnected()) {
    // you have access to Commands
    // and can call from here...
}

获取接口

use MikrotikAPI\Roar\Roar;
use MikrotikAPI\Commands\Interfaces;

$conn = Roar::create(['host_ip', 'port', 'username', 'password']);
 
if($conn->isConnected()) {
    $iComm = new Interfaces($conn);
    $interfaces = $iComm->getAll() // returns all interfaces as array
    
    // you can send it to view 
    return view("<some_view>", [
        'interfaces' => $interfaces
    ]);
}
由 anovob (A S M Saief) 创建
(cc) 2018
许可: MIT