PHP code example of zilleali / mikrotik-laravel
1. Go to this page and download the library: Download zilleali/mikrotik-laravel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zilleali / mikrotik-laravel example snippets
use ZillEAli\MikrotikLaravel\Facades\MikroTik;
// PPPoE
$sessions = MikroTik::pppoe()->getActiveSessions();
MikroTik::pppoe()->disableSecret('ali-home');
// Hotspot
$hosts = MikroTik::hotspot()->getActiveHosts();
// System
$cpu = MikroTik::system()->getCpuLoad();
// Queue
MikroTik::queue()->setLimit('ali-home', '10M', '10M');
// Multi-router
MikroTik::router('branch')->pppoe()->getActiveSessions();
// Streaming (v1.7.0)
foreach (MikroTik::pppoe()->streamSecrets() as $secret) {
// process one row at a time — no memory spike
}
// Testing (v1.7.0)
$fake = MikrotikFake::fake(['/ppp/secret/print' => [['name' => 'ali-home']]]);
$fake->assertQueried('/ppp/secret/print');
bash
php artisan vendor:publish --tag=mikrotik-config