PHPackages                             imafaz/mikrolink - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. imafaz/mikrolink

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

imafaz/mikrolink
================

lightweight library for manage mikrotik router os with api

1.0.1(1y ago)218MITPHP

Since Nov 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AfazTech/MikroLink)[ Packagist](https://packagist.org/packages/imafaz/mikrolink)[ Docs](https://github.com/imafaz/MikroLink)[ RSS](/packages/imafaz-mikrolink/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Lightweight PHP Library for MikroTik API Management
===================================================

[](#lightweight-php-library-for-mikrotik-api-management)

**MikroLink** is a lightweight PHP library designed for interacting with MikroTik routers using their API. This library simplifies the process of managing and automating tasks on MikroTik devices programmatically.

---

- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Available Methods](#available-methods)
- [License](#license)

---

Requirements
------------

[](#requirements)

To utilize this library effectively, ensure your environment meets the following requirements:

- PHP version 7.0 or higher

Installation
------------

[](#installation)

For seamless installation, use [Composer](http://getcomposer.org/download/):

```
composer require imafaz/mikrolink
```

Quick Start
-----------

[](#quick-start)

Once the library is installed, include it in your PHP script:

```
require_once 'vendor/autoload.php';

use MikrotikApi\MikroLink;
```

Usage
-----

[](#usage)

Initialize the MikroLink object with debug mode, timeout, attempts, and delay settings:

```
$router = new MikroLink;
```

Connect to a MikroTik router using its IP, username, password, port, and optional SSL mode:

```
$router->connect('192.168.1.1', 'admin', 'password', 8728, false);
```

Execute commands on the connected router:

```
$response = $router->exec('/interface/print');

var_dump($response); //print array response
```

disconnect router connection :

```
$router->disconnect();
```

Available Methods
-----------------

[](#available-methods)

### `__construct`

[](#__construct)

#### Description:

[](#description)

Initializes the MikroLink object with debugging and connection settings.

#### Signature:

[](#signature)

```
$router = new MikroLink( int $timeout = 1,  int $attempts = 3,int  $delay = 0,$logFile = 'mikrolink.log',$printLog = false);
```

#### Attributes:

[](#attributes)

AttributeDescriptionTypeRequiredDefault$timeoutConnection timeout (seconds)intNo1$attemptsConnection attemptsintNo3$delayDelay between attempts (sec)intNo0$logFilelog file namestringNomikrolink.log$printLogprint logboolNofalse---

### `connect`

[](#connect)

#### Description:

[](#description-1)

Connects to a MikroTik router using the provided credentials and connection details.

#### Signature:

[](#signature-1)

```
$router->connect(string $ip, string $username, string $password, int $port, $ssl = false);
```

#### Attributes:

[](#attributes-1)

AttributeDescriptionTypeRequiredDefault$ipRouter IP addressstringYesN/A$usernameRouter login usernamestringYesN/A$passwordRouter login passwordstringYesN/A$portRouter API portintYesN/A$sslSSL mode toggleboolNofalse---

### `exec`

[](#exec)

#### Description:

[](#description-2)

Executes a MikroTik API command with optional parameters.

#### Signature:

[](#signature-2)

```
$router->exec(string $command, array $params = null);
```

#### Attributes:

[](#attributes-2)

AttributeDescriptionTypeRequiredDefault$commandAPI command to executestringYesN/A$paramsAdditional command parametersarrayNonull---

### `disconnect`

[](#disconnect)

#### Description:

[](#description-3)

Terminates the connection with the MikroTik router.

#### Signature:

[](#signature-3)

```
$router->disconnect();
```

License
-------

[](#license)

This library is licensed under the [MIT License](https://opensource.org/licenses/MIT)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69a193cfdda61e7981d7ed0d451533a35edf52421f0d4f8c789d715a6d160a9b?d=identicon)[afaztech](/maintainers/afaztech)

---

Top Contributors

[![AfazTech](https://avatars.githubusercontent.com/u/106348299?v=4)](https://github.com/AfazTech "AfazTech (2 commits)")

---

Tags

mikrotikimafazMikroLinkmikrotik apiapi mikrotik

### Embed Badge

![Health badge](/badges/imafaz-mikrolink/health.svg)

```
[![Health](https://phpackages.com/badges/imafaz-mikrolink/health.svg)](https://phpackages.com/packages/imafaz-mikrolink)
```

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[godruoyi/php-snowflake

An ID Generator for PHP based on Snowflake Algorithm (Twitter announced).

8582.3M61](/packages/godruoyi-php-snowflake)[bitwasp/bitcoin

PHP Bitcoin library with functions for transactions, signatures, serialization, Random/Deterministic ECDSA keys, blocks, RPC bindings

1.1k533.2k43](/packages/bitwasp-bitcoin)[bitwasp/buffertools

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

65764.4k41](/packages/bitwasp-buffertools)[pocketmine/math

PHP library containing math related code used in PocketMine-MP

45573.2k14](/packages/pocketmine-math)[pocketmine/nbt

PHP library for working with Named Binary Tags

42574.4k13](/packages/pocketmine-nbt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
