-
Notifications
You must be signed in to change notification settings - Fork 3
v1.4.0
ZILLEALI edited this page May 26, 2026
·
1 revision
Released: 2026-05-26
Tag: v1.4.0
Install: composer require zilleali/mikrotik-laravel:^1.4.0
Developer experience release — adds PHPStan level 5 static analysis and detailed exception factory methods with actionable error messages.
Zero errors at PHPStan level 5 — added to CI pipeline.
./vendor/bin/phpstan analyse src --level=5What was fixed:
-
MikroTikFacade — allusestatements added -
@methoddocblocks — correct namespaces
Before:
throw new ConnectionException("Failed to connect after 3 attempt(s): Connection refused");After — actionable messages:
// Unreachable host
throw ConnectionException::unreachable('192.168.1.1', 8728, 'main', 'Connection refused');
// "Cannot connect to router 'main' at 192.168.1.1:8728 — Connection refused"
// Wrong credentials
throw ConnectionException::authenticationFailed('192.168.1.1', 8728, 'admin', 'main');
// "Authentication failed for user 'admin' on router 'main' (192.168.1.1:8728). Check username and password."
// Timeout
throw ConnectionException::timeout('192.168.1.1', 8728, 10, 'main');
// "Connection to router 'main' (192.168.1.1:8728) timed out after 10 seconds."
// Router not in config
throw ConnectionException::routerNotFound('branch');
// "Router 'branch' not found in config/mikrotik.php routers array. Add it under 'routers' key."
// All retries failed
throw ConnectionException::retriesExhausted('192.168.1.1', 8728, 3, 'main', $previous);
// "Failed to connect to router 'main' (192.168.1.1:8728) after 3 attempt(s)."Exception properties:
try {
MikroTik::pppoe()->getActiveSessions();
} catch (ConnectionException $e) {
$e->getHost(); // '192.168.1.1'
$e->getPort(); // 8728
$e->getRouter(); // 'main'
$e->getMessage(); // Full message
}// From RouterOS !trap response
throw ApiException::fromTrap('/ppp/secret/add', [
'message' => 'already have such entry',
'category' => '2',
]);
// "RouterOS API error on command '/ppp/secret/add': already have such entry"
// Permission denied
throw ApiException::permissionDenied('/system/reboot', 'monitor');
// "Permission denied for user 'monitor' on command '/system/reboot'. Check RouterOS user group policies."
// Not found
throw ApiException::notFound('/ppp/secret/set', 'user1');
// "Item 'user1' not found via command '/ppp/secret/set'."Exception properties:
try {
MikroTik::pppoe()->createSecret([...]);
} catch (ApiException $e) {
$e->getCommand(); // '/ppp/secret/add'
$e->getCategory(); // '2'
$e->getDetail(); // additional detail
}All existing code works without modification.
composer update zilleali/mikrotik-laravel← v1.3.0 | Managers Reference →
📝 Found an error or missing info?
Edit this page or open an issue to suggest improvements.