定制 ariyanshipu/router-os 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ariyanshipu/router-os

最新稳定版本:v2.0.0

Composer 安装命令:

composer require ariyanshipu/router-os

包简介

Mikrotik API PHP Library for working with RouterOS API

README 文档

README

 composer require ariyanshipu/router-os

Example: Default Connection


    namespace App\Http\Controllers;
    use MikrotikAPI\Talker\Talker;
    use \MikrotikAPI\Entity\Auth;
    use MikrotikAPI\Commands\IP\Address;
    use MikrotikAPI\Util\DebugDumper;
class DemoController extends Controller
{
    public function index()
    {
        $auth = new Auth();
        $auth->setHost("10.20.32.1");
        $auth->setUsername("123");
        $auth->setPassword("123");
        //$auth->setPort("8080"); //if you are already change API Port on your Mikrotik OS please Uncomment $auth->setPort("8080") set your own port

        $auth->setDebug(true);


        $talker = new Talker($auth);
        //$filter = new FirewallFilter($talker);
        //$a = $filter->getAll();

        if($talker)
        {
            $ipaddr = new Address($talker);
            $listIP = $ipaddr->getAll();
            DebugDumper::dump($listIP);
        }
        
        return view('demo.index');

    }
}

Example: Default Output


Array
(
    [0] => Array
        (
            [.id] => *2
            [address] => 10.20.32.1/24
            [network] => 10.20.32.0
            [interface] => ether2
            [actual-interface] => ether2
            [invalid] => false
            [dynamic] => false
            [disabled] => false
            [comment] => hotspot network
        )
[1] => Array
    (
        [.id] => *7
        [address] => 10.18.18.1/30
        [network] => 10.18.18.0
        [interface] => ether5
        [actual-interface] => ether5
        [invalid] => false
        [dynamic] => false
        [disabled] => false
        [comment] => pc
    )

[2] => Array
    (
        [.id] => *8
        [address] => 192.168.1.1/24
        [network] => 192.168.1.0
        [interface] => ether1
        [actual-interface] => ether1
        [invalid] => false
        [dynamic] => false
        [disabled] => true
        [comment] => pc
    )

[3] => Array
    (
        [.id] => *C
        [address] => 192.168.12.1/24
        [network] => 192.168.12.0
        [interface] => ether1
        [actual-interface] => ether1
        [invalid] => false
        [dynamic] => false
        [disabled] => true
        [comment] => pc
    )

[4] => Array
    (
        [.id] => *E
        [address] => 10.80.15.2/30
        [network] => 10.80.15.0
        [interface] => ether1
        [actual-interface] => ether1
        [invalid] => false
        [dynamic] => false
        [disabled] => false
        [comment] => WAN
    )

)

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-21