Hello MikroTik community,
I want to share an open-source PHP/Laravel package I just released for RouterOS API integration.
GitHub: GitHub - Zilleali/mikrotik-laravel: MikroTik RouterOS API for Laravel - PPPoE, Hotspot, Queues & Monitoring · GitHub
Packagist: https://packagist.org/packages/zilleali/mikrotik-laravel
Install with one command:
composer require zilleali/mikrotik-laravel
WHAT IT DOES:
The package wraps the RouterOS API into clean, organized Laravel service classes. Instead of writing raw API sentences, you get a clean PHP interface:
// PPPoE
$sessions = MikroTik::pppoe()->getActiveSessions();
MikroTik::pppoe()->kickSession('user1');
MikroTik::pppoe()->bulkDisable(['user1', 'user2']);
// System health
$cpu = MikroTik::system()->getCpuLoad();
$uptime = MikroTik::system()->getUptime();
// Wireless
$clients = MikroTik::wireless()->getRegistrationTable();
// Queue
MikroTik::queue()->setLimit('user1', '10M', '10M');
MikroTik::queue()->bulkSetLimit($users);
// Firewall
MikroTik::firewall()->addToAddressList('1.2.3.4', 'blocked');
// WireGuard
MikroTik::vpn()->getWireGuardPeers();
MikroTik::vpn()->addWireGuardPeer([...]);
MANAGERS INCLUDED (12 total):
- PppoeManager — secrets, profiles, active sessions, bulk kick/enable/disable
- HotspotManager — users, profiles, active hosts, voucher generation
- QueueManager — simple/tree queues, bulk bandwidth limits
- FirewallManager — filter rules, NAT, mangle, address lists
- SystemManager — resources, health (temp/voltage), logs, ping, reboot
- InterfaceManager — status, traffic monitoring, VLANs
- DhcpManager — leases, static assignments
- WirelessManager — registration table, access list
- IpPoolManager — pool ranges, used address tracking
- RadiusManager — RADIUS servers, CoA incoming config
- RouterUserManager — Winbox/SSH/API users, groups
- VpnManager — WireGuard peers, L2TP sessions, PPTP sessions
TECHNICAL DETAILS:
- Implements RouterOS sentence protocol (variable-length encoding)
- Supports RouterOS v6.43+ plain login AND legacy MD5 challenge-response
- Multi-router support — manage multiple routers from one app
- Caching layer — reduces API calls on production hardware
- Retry mechanism — configurable attempts + delay
- Laravel Events for session connect/disconnect/router-down
- Artisan commands: mikrotik:ping, mikrotik:sync, mikrotik:monitor
- 70+ unit tests, CI on PHP 8.2/8.3 x Laravel 11/12
WHY I BUILT THIS:
I'm a network engineer (MTCNA certified) building NexaLink — an ISP management SaaS for MikroTik-based ISPs. I needed a reliable RouterOS API layer for Laravel. After building it, I packaged it properly and released it as open source.
Tested on:
- hAP ac² (RBD52G)
- RouterOS 7.14.3
- RouterOS 6.49.x
FEEDBACK WELCOME:
If you find bugs, RouterOS version incompatibilities, or missing features — please open an issue on GitHub. PRs are very welcome.
Specially interested in feedback from engineers running:
- CCR series (high session counts)
- RouterOS 7.x (newer API behaviors)
- Large IP pools (1000+ PPPoE users)
Zill E Ali
MTCNA Certified | Zilleali (ZILLEALI) · GitHub