jjsquady / mikrotikapi
An Mikrotik Api Wrapper
Installs: 1 167
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 4
Forks: 3
Open Issues: 1
Requires
- pear2/net_routeros: 1.0.0b5
- pear2/net_transmitter: 1.0.0a5
Requires (Dev)
- laravel/framework: 5.8.*
- orchestra/testbench: ~3.8
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2021-12-25 22:05:52 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.