ppalacinp / mikrotikapi
An Mikrotik Api Wrapper
0.2
2020-10-25 17:12 UTC
Requires
- php: ^7.4
- pear2/net_routeros: 1.0.0b6
- pear2/net_transmitter: 1.0.0b2
Requires (Dev)
- laravel/framework: ^8.11
- orchestra/testbench: ^6.2
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2025-02-22 21:09:29 UTC
README
WIP - Work In Progress
Instalation
Via composer:
composer require jjsquady/mikrotikapi
Or manually insert this block into your composer.json in require section:
"require": {
"jjsquady/mikrotikapi": "dev-master", // <- this line
}
Configuration on Laravel (< 5.4):
Insert into config/app.php
in providers
array:
jjsquady\MikrotikApi\MikrotikServiceProvider::class
Use the Facade:
Insert into config/app.php
in facades
array:
'Mikrotik' => jjsquady\MikrotikApi\Facades\MikrotikFacade::class
Note: for Laravel 5.4+ this package comes with Package Discovery enabled.
Publish the configuration file:
php artisan vendor:publish --provider=jjsquady\MikrotikApi\MikrotikServiceProvider
Basic Usage:
Set up the host and credentials into .env file:
MK_API_HOST=<mk_ip>
MK_API_USER=<username>
MK_API_PASSWORD=<password>
MK_API_PORT=<mk_port_defaults_8728>
// create a connection with Mikrotik Router
$conn = Mikrotik::connect()->getConnection();
if($conn->isConnected()) {
// you have access to Commands
// and can call from here...
}
Getting interfaces:
$conn = Mikrotik::connect()->getConnection();
if($conn->isConnected()) {
// Get all interfaces
$interfaces = Interfaces::bind($conn)->get();
// get() returns a Collection and you can use all methods available
// you can send it to view
return view("<some_view>", [
'interfaces' => $interfaces
]);
}
This project its a work in progress... and its in early developing phase. I really get thankful with ur contribution.