ardigital/mikrotik

Mikrotik Router Board Api By Ardigital.ge

dev-master 2020-04-12 19:50 UTC

This package is auto-updated.

Last update: 2024-04-13 04:26:05 UTC


README

Table of Contents

Installation

composer require ardigital/mikrotik

For Laravel <= 6.x

Open config/app.php and add MikrotikServiceProvider to the providers array.

'providers' => [
   ArDigital\Mikrotik\MikrotikServiceProvider::class,
],

Then run:

php artisan vendor:publish --provider="ArDigital\Mikrotik\MikrotikServiceProvider"

Place Mikortik username and password configuration config/mikrotik.php file Or .env :

 
MIKROTIK_IP=10.10.0.1
MIKROTIK_USERNAME=user
MIKROTIK_PASSWORD=password

Usage

Mikrotik Class

Add a class of Mikrotik to your Controller

use ArDigital\Mikrotik\Mikrotik;

public function getIpList(){
  $ip_list = new Mikrotik();
 return $ip_list->getIps();  // return associative array
}
etc commands:
public function firewallFilter(){
 $ip_list = new Mikrotik();
 return $ip_list->firewallFilter(); // return associative array
}
// Other methods
//interfaces, firewallFilter, firewallNat, rebootSystem, dhcpClient, dhcpServer

// With this method you can run an command whose method does not exist in the class
// Example:
public function OtherCommand(){
    $mikrotik = new  Mikrotik();
     return $mikrotik->Command('/system/resource/print');
}

//Add Configuration Example:
 public function AddConfig()
    {
        $mikrotik = new  Mikrotik();
        $configuration = $mikrotik->AddConfig('/ip address', [
            'address' => '192.168.88.12',
            'interface' => 'ether4',
            'comment' => 'Example Comment'
        ]);
      return $configuration;
    }

68747470733a2f2f692e6962622e636f2f6252466e4e46342f6d696b726f69746b2d726f757465722d6170692e706e67