PHPackages                             anandaerditya/routeros-api-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. anandaerditya/routeros-api-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

anandaerditya/routeros-api-php
==============================

Mikrotik RouterOS API Communicator Module for PHP

1.6.3(11mo ago)2281↓42.9%MITPHPPHP ^8.0

Since Aug 7Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/anandaerditya/routeros-api-php)[ Packagist](https://packagist.org/packages/anandaerditya/routeros-api-php)[ RSS](/packages/anandaerditya-routeros-api-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

Mikrotik RouterOS API PHP Module
================================

[](#mikrotik-routeros-api-php-module)

[![Static Badge](https://camo.githubusercontent.com/32ac7cc3311f967a99f3fcfea352860103ca86ba61d13d50d0c2f8bb3bcda97e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e305f616e645f75702d6537346333633f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/32ac7cc3311f967a99f3fcfea352860103ca86ba61d13d50d0c2f8bb3bcda97e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e305f616e645f75702d6537346333633f7374796c653d666f722d7468652d6261646765)[![Packagist Version](https://camo.githubusercontent.com/6f2495965a90c6c37a31ce2882ffd45b5613d2afdfb55d32c25b75c0570a89d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e616e6461657264697479612f726f757465726f732d6170692d7068703f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d66666666666626636f6c6f723d253233663238643161266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246616e616e646165726469747961253246726f757465726f732d6170692d706870)](https://camo.githubusercontent.com/6f2495965a90c6c37a31ce2882ffd45b5613d2afdfb55d32c25b75c0570a89d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e616e6461657264697479612f726f757465726f732d6170692d7068703f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d66666666666626636f6c6f723d253233663238643161266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246616e616e646165726469747961253246726f757465726f732d6170692d706870)[![GitHub Release](https://camo.githubusercontent.com/c64791a5b43c2c0067386b754da452e8821dfadd5a0bffd00eda6ceea3914ecd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f616e616e6461657264697479612f726f757465726f732d6170692d7068703f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d67697468756226636f6c6f723d316162633963266c696e6b3d68747470732533412532462532466769746875622e636f6d253246616e616e646165726469747961253246726f757465726f732d6170692d706870)](https://camo.githubusercontent.com/c64791a5b43c2c0067386b754da452e8821dfadd5a0bffd00eda6ceea3914ecd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f616e616e6461657264697479612f726f757465726f732d6170692d7068703f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d67697468756226636f6c6f723d316162633963266c696e6b3d68747470732533412532462532466769746875622e636f6d253246616e616e646165726469747961253246726f757465726f732d6170692d706870)

This library is using API Client Communicator under PHP Socket, thanks to the repository from [EvilFreelance](https://github.com/EvilFreelancer/routeros-api-php). This library provides built-in methods based on the available configuration under Winbox, with their respective commands and parameters. At the moment, this library supports RouterBoard and Cloud Router Switch with pre-6.43 and post-6.43 versions of RouterOS, as mentioned [in this repository](https://github.com/EvilFreelancer/routeros-api-php).

---

Changelog
---------

[](#changelog)

### **1.6.2 ( Enhancement, Feature )**

[](#162--enhancement-feature-)

1. Update commands and their parameters into the following methods:

    - `router_switch()`,
    - `router_switch_port()`,
    - `router_switch_port_isolation()`,
2. Add new methods :

    - `router_switch_rule()`

### **1.5.3 ( Bugfix, Feature )**

[](#153--bugfix-feature-)

1. Add new methods :
    - `system_resource()`,
    - `system_resource_cpu()`,
    - `system_resource_irq()`,
    - `system_resource_pci()`,
    - `system_resource_usb()`,
    - `interface_bridge_calea()`,
    - `interface_bridge_filter()`,

### **1.5.3 ( Bugfix )**

[](#153--bugfix-)

1. Add message handler for `!trap`, `!re`, `!done`, and `!fatal` type under the `send()` method.

---

### **1.4.2 ( Bugfix )**

[](#142--bugfix-)

1. Fix Mikrotik API response message handling under `send()` method;

---

### **1.3.22 ( Hotfix )**

[](#1322--hotfix-)

1. Add new Exception : ErrorException;
2. Add error handler for each method to catch any errors under mikrotik API.
3. Add new methods :
    - `ip_dhcp_server_lease()`
    - `ip_arp()`
    - `router_switch()`
    - `router_switch_port()`

---

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

[](#requirements)

- `PHP` : Version 8.0 and up
- `ext-sockets` : A Socket extension for PHP
- `RouterOS` : **pre-6.43** and **post-6.43** (Tested on **RouterBoard** and **Cloud Router Switch** device)

---

How to Install
--------------

[](#how-to-install)

Under composer, just copy this command to begin add this library into your project.

```
composer require anandaerditya/routeros-api-php

```

---

Using the Library
-----------------

[](#using-the-library)

If you are using Composer Project such Laravel Framework, you can just call the library under `Erditya\RouterOSInstance` class. As follows :

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

    use Erditya\RouterOSInstance;

    $router = new RouterOSInstance();

    # Create connection
    $router = $router->connect(
        [
            'host' => '192.168.10.1',
            'user' => 'username',
            'pass' => 'password',
            'port' => 8728
        ]
    );

    # Example : Fetch all IP Addresses
    if ($router->is_connected()) {
        # Get All Addresses
        var_dump($router->ip_addresses());

        # Get address with interface ether2
        var_dump($router->ip_addresses(['interface' => 'ether2']));

        # Update address item in ID *2
        var_dump($router->ip_addresses('set', [
            '.id' => '*2',
            'comment' => 'Some Comments'
        ]));
    }
```

Or, another way to approach :

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

    use Erditya\RouterOSInstance;

    $router = new RouterOSInstance();

    # Create connection
    $router = $router->connect(
        [
            'host' => '192.168.10.1',
            'user' => 'username',
            'pass' => 'password',
            'port' => 8728
        ]
    );

    # Get All Addresses
    var_dump($router->ip_addresses());

    # Get address with interface ether2
    var_dump($router->ip_addresses(['interface' => 'ether2']));

    # Update address item in ID *2
    var_dump($router->ip_addresses('set', [
        '.id' => '*2',
        'comment' => 'Some Comments'
    ]));
```

---

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

[](#available-methods)

List of all methods available in this library at this version :

1. **General**

    - `connect()`
    - `is_connected()`
2. **Interface**

    - `interface_bridge()`
    - `interface_bridge_port()`
    - `interface_bridge_port()`
    - `interface_ethernet()`
    - `interface_list()`
    - `interface_list_member()`
    - `interface_vlan()`
3. **IP**

    - `ip_addresses()`
    - `ip_dhcp_server()`
    - `ip_dhcp_server_network()`
    - `ip_dns()`
    - `ip_firewall_filter()`
    - `ip_firewall_nat()`
    - `ip_hotspot_user_profiles()`
    - `ip_hotspot_users()`
    - `ip_hotspot_server_profiles()`
    - `ip_hotspot_servers()`
    - `ip_hotspot_ip_binding()`
    - `ip_pool()`
    - `ip_route()`
    - `ip_services()`
4. **System**

    - `system_identity()`
    - `system_user_groups()`
    - `system_users()`
5. **Switch (for Cloud Router Switch only)**

    - `switch_crs_egress_vlan_tag()`
    - `switch_crs_mac_based_vlan()`
    - `switch_crs_port()`

---

Commands &amp; Parameters, and Response
---------------------------------------

[](#commands--parameters-and-response)

All the methods provided in this library are similar to Winbox's CLI terminal. You can check them under Winbox for more information. All the methods using the command `print` as the default returned the response as an array. If you call the method using another command, such as `add`, `set`, `remove`, etc., the method will return `true`, which indicates it was successfully executed.

---

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance50

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~58 days

Recently: every ~72 days

Total

6

Last Release

354d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0392ff72144aa5855fc72c78a34a7fa7eff08a556c5d603d8c80747aa1a88ee?d=identicon)[anandaerditya](/maintainers/anandaerditya)

---

Top Contributors

[![anandaerditya](https://avatars.githubusercontent.com/u/45676405?v=4)](https://github.com/anandaerditya "anandaerditya (31 commits)")

### Embed Badge

![Health badge](/badges/anandaerditya-routeros-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/anandaerditya-routeros-api-php/health.svg)](https://phpackages.com/packages/anandaerditya-routeros-api-php)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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