Download the PHP package jauhar/router-api without Composer
On this page you can find all versions of the php package jauhar/router-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package router-api
Mikrotik PHP API Package
๐ Introduction
The Mikrotik PHP API package provides a convenient and easy-to-use interface to communicate with your MikroTik RouterOS device using PHP. This package is designed to simplify the process of automating your Mikrotik router, including managing interfaces, configuring IPs, monitoring traffic, and more.
Whether you're building network monitoring tools or automating network configuration, this package helps you interact with MikroTik API programmatically.
โจ Features
- ๐ก Easy RouterOS API Integration: Simple API wrapper to interact with RouterOS.
- ๐ ๏ธ Manage Configuration: Create, modify, and delete Mikrotik configurations (IP, firewall, interfaces, etc.).
- ๐ Monitor and Analyze Traffic: Retrieve real-time data such as traffic stats, resource usage, and more.
- ๐ Secure Connection: Secure communication with the router using Mikrotik API.
- โก Fast and Lightweight: Efficient data exchange with minimal overhead.
๐ ๏ธ Installation
Install the package via Composer:
Alternatively, download the package and include the class manually.
๐ Quick Start
1. Establishing Connection
To begin, you'll need to establish a connection to your Mikrotik RouterOS device using the API.
2. Retrieving Interface Information By Parameter
Retrieve a list of all interfaces from the router with query parameter :
๐ API Reference
Methods Overview
getById($host, $username, $password, $port = 8728)
Connect to the Mikrotik RouterOS device.query($command, $paramType = true)
Send a command to the router. Usefalse
for sending multiple parts of the same command.where()
Read the response from RouterOS.disconnect()
Terminate the connection with the RouterOS API.
Common Commands
/interface/print
Retrieve the list of interfaces.-
/ip/address/add
Add a new IP address to an interface. /ip/address/remove
Remove an IP address from the router.
Example Usage
- Get traffic stats:
๐ก๏ธ Security
Ensure that the Mikrotik API service is securely enabled and that your API connection is not exposed to public networks. It is recommended to use SSH or a VPN when working with the API.
๐งช Testing
You can test the API using a local development environment or any PHP web server. Make sure that you have:
- Enabled the Mikrotik API service on your router.
- Correct firewall rules to allow access to the API port.
๐ค Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or features.
- Fork the repository.
- Create a new branch for your feature or fix.
- Submit a pull request and describe the changes.
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
๐ก Need Help?
If you encounter any issues, feel free to reach out by creating an issue on the GitHub repository or by visiting Mikrotik Forums.
Made with โค๏ธ by Jauhar Imtikhan
Enjoy building your network automation tools with Mikrotik PHP API!