-
Notifications
You must be signed in to change notification settings - Fork 3
v1.1.0
Released: 2026-05-18
Tag: v1.1.0
Install: composer require zilleali/mikrotik-laravel:^1.1.0
v1.1.0 adds SSL/TLS encrypted API connection, Bridge Manager for L2 network management, persistent ConnectionPool, and framework-agnostic widget data classes for dashboards.
TLS encrypted connection to RouterOS API on port 8729.
Enable on router first: WinBox → IP → Services → api-ssl → Enable IP → Services → api-ssl → Port: 8729
Enable via .env:
MIKROTIK_SSL=true
MIKROTIK_SSL_VERIFY=false
MIKROTIK_PORT=8729Auto-selected from config:
// No code change needed — auto-selected based on config
MikroTik::pppoe()->getActiveSessions(); // uses SSL if MIKROTIK_SSL=trueManual usage:
use ZillEAli\MikrotikLaravel\Connections\RouterosClientSSL;
// Self-signed cert (ISP standard)
$client = new RouterosClientSSL(
host: '192.168.88.1',
port: 8729,
username: 'admin',
password: 'secret',
verifyPeer: false,
);
$client->connect();
// Strict mode — valid CA cert
$client = new RouterosClientSSL(
host: 'router.yourisp.com',
port: 8729,
username: 'admin',
password: 'secret',
verifyPeer: true,
caCertPath: '/etc/ssl/certs/ca-certificates.crt',
);
$client->connect();Connection info:
$info = $client->getConnectionInfo();
// [
// 'host' => '192.168.88.1',
// 'port' => 8729,
// 'ssl' => true,
// 'connected' => true,
// 'verify_peer' => false,
// ]Complete L2 bridge management for MikroTik routers.
Bridges:
// Get all bridges
$bridges = MikroTik::bridge()->getBridges();
// Get single bridge
$bridge = MikroTik::bridge()->getBridge('bridge1');
// Create bridge
MikroTik::bridge()->addBridge([
'name' => 'bridge1',
'vlan-filtering' => 'yes',
'comment' => 'Main LAN bridge',
]);
// Remove bridge
MikroTik::bridge()->removeBridge('bridge1');Bridge Ports:
// All ports
$ports = MikroTik::bridge()->getBridgePorts();
// Ports on specific bridge
$ports = MikroTik::bridge()->getBridgePortsByBridge('bridge1');
// Port count
$count = MikroTik::bridge()->getPortCount('bridge1');
// Add port
MikroTik::bridge()->addBridgePort([
'bridge' => 'bridge1',
'interface' => 'ether5',
'comment' => 'Client uplink',
]);
// Remove port
MikroTik::bridge()->removeBridgePort('ether5');Bridge Host Table (MAC tracking):
// All hosts
$hosts = MikroTik::bridge()->getBridgeHosts();
// Hosts on specific bridge
$hosts = MikroTik::bridge()->getBridgeHostsByBridge('bridge1');Bridge Filters (L2 firewall):
// Get filters
$filters = MikroTik::bridge()->getBridgeFilters();
// Add filter rule
MikroTik::bridge()->addBridgeFilter([
'chain' => 'forward',
'action' => 'drop',
'mac-protocol' => 'ip',
'comment' => 'Block IP forwarding',
]);Persistent connections — prevents TCP reconnect on every manager call.
Automatic usage:
// MikrotikManager uses pool internally — no code change needed
MikroTik::pppoe()->getActiveSessions(); // connection cached
MikroTik::system()->getCpuLoad(); // reuses same connection
MikroTik::hotspot()->getUsers(); // reuses same connectionManual pool access:
$pool = MikroTik::getPool();
// Check connection health
$alive = $pool->isAlive('default');
$alive = $pool->isAlive('branch');
// All connections status
$summary = $pool->getSummary();
// ['default' => ['connected' => true], 'branch' => ['connected' => false]]
// Active connections
$active = $pool->getAliveConnections();
// All router names in pool
$names = $pool->getNames();
// Count
$count = $pool->count();
// Cleanup dead connections
$removed = $pool->pruneDeadConnections();
// Disconnect specific router
MikroTik::disconnect('branch');
// Disconnect all
MikroTik::disconnectAll();
// or
$pool->flush();Framework-agnostic data providers for NOC dashboards. No Filament or UI dependency required.
ActiveSessionsWidget:
use ZillEAli\MikrotikLaravel\Filament\Widgets\ActiveSessionsWidget;
$widget = new ActiveSessionsWidget();
// Polling interval
echo $widget->pollingInterval; // '30s'
// Get data
$stats = $widget->getStats();
// [
// ['label' => 'Total Active', 'value' => 180],
// ['label' => 'PPPoE Sessions', 'value' => 142],
// ['label' => 'Hotspot Hosts', 'value' => 38],
// ]RouterHealthWidget:
use ZillEAli\MikrotikLaravel\Filament\Widgets\RouterHealthWidget;
$widget = new RouterHealthWidget();
$stats = $widget->getStats();
// [
// ['label' => 'MyRouter', 'value' => 'CPU 12%', 'description' => 'RouterOS 7.14'],
// ['label' => 'RAM Usage', 'value' => '45%', 'description' => 'Memory utilization'],
// ['label' => 'Uptime', 'value' => '14d6h', 'description' => 'Router uptime'],
// ]BandwidthChartWidget:
use ZillEAli\MikrotikLaravel\Filament\Widgets\BandwidthChartWidget;
$widget = new BandwidthChartWidget();
// Default interface
echo $widget->interface; // 'ether1'
// Chart data (chart.js compatible)
$data = $widget->getData();
// [
// 'datasets' => [
// ['label' => 'TX (Mbps)', 'data' => [12, 15, 18], 'borderColor' => '#1D9E75'],
// ['label' => 'RX (Mbps)', 'data' => [45, 52, 48], 'borderColor' => '#1F6FEB'],
// ],
// 'labels' => ['14:30:00', '14:30:30', '14:31:00'],
// ]
// Chart type
echo $widget->getType(); // 'line'InterfaceTableWidget:
use ZillEAli\MikrotikLaravel\Filament\Widgets\InterfaceTableWidget;
$widget = new InterfaceTableWidget();
$interfaces = $widget->getInterfaces();
// [
// ['name' => 'ether1', 'type' => 'ether', 'running' => true, 'disabled' => false],
// ['name' => 'ether2', 'type' => 'ether', 'running' => false, 'disabled' => true],
// ]- 246 unit tests
- CI: PHP 8.2/8.3 × Laravel 11/12
📝 Found an error or missing info?
Edit this page or open an issue to suggest improvements.