承接 rakibas375/mikrotik-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rakibas375/mikrotik-php

Composer 安装命令:

composer require rakibas375/mikrotik-php

包简介

A PHP class for managing MikroTik users via API. This package allows you to add, remove, and update users, monitor their status (online/offline), and manage their bandwidth and packages on MikroTik routers. It simplifies integration with MikroTik routers and helps automate the process of user manage

README 文档

README

A PHP class for managing MikroTik users via API. This package allows you to add, remove, and update users, monitor their status (online/offline), and manage their bandwidth and packages on MikroTik routers. It simplifies integration with MikroTik routers and helps automate the process of user management in an ISP billing system.

Features

  • User Management: Add, remove, or update users on MikroTik routers.
  • Bandwidth Management: Monitor and manage user bandwidth and speed limits.
  • Online/Offline Monitoring: Check user status (online or offline).
  • API Integration: Easy integration with MikroTik routers via their API.

Installation

To install the package, you can use Composer:

composer require rakibas375/mikrotik-php

<?php

require 'vendor/autoload.php';

use Rakib\Mikrotik\MikrotikAPI;

// Create an instance of the class
$mk = new MikrotikAPI();

// Add a user to MikroTik router
$userInfo = [
    'username' => 'newuser',       // The username for the new user
    'password' => 'password123',   // The password for the new user
    'profile'  => 'default',       // The profile to assign the user (e.g., bandwidth profile)
    'routerIp' => '192.168.88.1',  // The IP address of the MikroTik router
];

// Add the user and get the response from MikroTik
$response = $mk->user_add($userInfo);

// Print the response from MikroTik API (success or error message)
echo $response;

 Methods
user_add($userInfo)
This method is used to add a new user to the MikroTik router.

Parameters:
$userInfo (array): An associative array containing user details such as username, password, and profile.
$userInfo = [
    'username' => 'newuser',
    'password' => 'password123',
    'profile'  => 'default',
    'routerIp' => '192.168.88.1',
];
$mk->user_add($userInfo);


get_all_online_users()
This method retrieves all users who are currently online.
$onlineUsers = $mk->get_all_online_users();
echo "Currently online users: " . implode(', ', $onlineUsers);


get_all_offline_users()
This method retrieves all users who are currently offline.
$offlineUsers = $mk->get_all_offline_users();
echo "Currently offline users: " . implode(', ', $offlineUsers);

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-02-23