-
Notifications
You must be signed in to change notification settings - Fork 273
Home
Welcome to the documentation for routeros-api, the RouterosAPI PHP client for the MikroTik RouterOS API Documentation written by @Zill E Ali.
This class gives you a thin, dependency-free PHP interface to the RouterOS API protocol: connect to a router, send commands, and read structured responses. It has no namespace and no external dependencies, just one file you can require or pull in with Composer.
- Installation - Composer setup, manual include, and enabling the API service on RouterOS
- Quick Start - your first working connection in under 10 lines
- API Reference - every public property and method, documented from source
-
Writing Queries - how to build
comm()calls, including filter (?) and regex (~) queries -
SSL and TLS Connections - using
api-ssl, thecertlessflag, and the OpenSSL 1.1+ cipher issue - Troubleshooting and FAQ - the errors people actually hit, and what causes them
- Changelog and Version Notes - version history and known open issues
##30-second example
<?php
require 'routeros_api.class.php';
$API = new RouterosAPI();
if ($API->connect('192.168.88.1', 'admin', 'password')) {
$interfaces = $API->comm('/interface/print');
print_r($interfaces);
$API->disconnect();
}That is the whole workflow: connect, run a command, read the parsed result, disconnect. Everything else in this wiki is detail on top of that.
The class was originally written by Denis Basta for the old MikroTik wiki (archived at web.archive.org), and has been maintained here since by Ben Menking and a number of contributors. It predates PSR autoloading standards, which is why it ships as a single global class rather than a namespaced package, that is expected, not a bug.
If you are looking for a more modern, namespaced, PHP 7/8 native alternative with PSR support, see the Changelog and Version Notes page for a short comparison note.
Documentation maintained by Zill E Ali Network Engineer, MikroTik RouterOS / ISP infrastructure specialist, MTCNA Certified
- GitHub: github.com/Zilleali
- Website: zilleali.com
- LinkedIn: linkedin.com/in/zilleali12
Found an error or have something to add? Open a PR against this wiki or reach out directly.