mivodev/laravel-mikrotik-api-ros7

Laravel wrapper for mivodev/mikrotik-api-ros7. Provides ServiceProvider, Facade, and config.

Maintainers

Package info

github.com/mivodev/laravel-mikrotik-api-ros7

pkg:composer/mivodev/laravel-mikrotik-api-ros7

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-05-27 18:57 UTC

This package is auto-updated.

Last update: 2026-05-27 18:57:35 UTC


README

Laravel Mikrotik API ROS7

Laravel Mikrotik API ROS7

PHP Version Laravel Version License

A clean, elegant Laravel wrapper for mivodev/mikrotik-api-ros7. Provides a ServiceProvider, Facade, configuration file, and Hybrid Connection Manager for seamless multi-tenant integration into your Laravel application.

Installation

composer require mivodev/laravel-mikrotik-api-ros7

Publish the configuration file:

php artisan vendor:publish --tag=mikrotik-ros7-config

Configuration

After publishing, you can configure your default router credentials in your .env file:

MIKROTIK_ROS7_HOST=192.168.1.1
MIKROTIK_ROS7_USERNAME=admin
MIKROTIK_ROS7_PASSWORD=rahasia
MIKROTIK_ROS7_PORT=443
MIKROTIK_ROS7_VERIFY_SSL=false
MIKROTIK_ROS7_TIMEOUT=10

Usage

Use the MikrotikRos7 facade to easily communicate with your routers anywhere in your Laravel app.

Using Default Connection

By default, the Facade uses the connection defined in .env.

use Mivo\LaravelMikrotikRos7\Facades\MikrotikRos7;

// Execute commands on the default router using Native REST
$identity = MikrotikRos7::get('/rest/system/identity');

// Or using Legacy CLI Mapping
$users = MikrotikRos7::comm('/ip/hotspot/user/print');

Hybrid Multi-Tenant Connections

For SaaS platforms like Mivo Enterprise, you don't store router credentials in .env. Instead, you retrieve them dynamically from your database. The Manager supports passing an array directly to establish a dynamic, cached connection:

use App\Models\Router;
use Mivo\LaravelMikrotikRos7\Facades\MikrotikRos7;

$router = Router::find(1);

// Build connection dynamically from database model
$client = MikrotikRos7::connection([
    'host'       => $router->vpn_assigned_ip,
    'username'   => $router->api_username,
    'password'   => $router->api_password,
    'port'       => 443,
    'verify_ssl' => false,
]);

// Execute command on that specific router
$activeUsers = $client->get('/rest/ip/hotspot/active');

// Disconnect from the specific router
$client->disconnect();

Advanced Examples

See the core package documentation for full usage of the REST methods and the comm() legacy CLI mapping method.

License

MIT License. See LICENSE for details.