Installation with Composer - class not found
alkar1 opened this issue · 2 comments
alkar1 commented
I did:
in composer.json, section require:
"pear2/net_transmitter": "1.0.0b2", "pear2/net_routeros": "1.0.0b6",
next in console: composer update
next in php code:
`
require_once 'vendor/autoload.php';
try {
$util = new PEAR2\RouterOS\Util($client = new PEAR2\RouterOS\Client('x.x.x.x.', 'admin', ''));
foreach ($util->setMenu('/log')->getAll() as $entry) {
echo $entry('time') . ' ' . $entry('topics') . ' ' . $entry('message') . "\n";
}
} catch (Exception $e) {
echo 'Unable to connect to RouterOS.';
}
`
and I got error:
PHP Fatal error: Class 'PEAR2\RouterOS\Util' not found in /var/www/lmsGitNew/mt-logs.php on line 154
By other classes from Composer working;
alkar1 commented
Ok,I found.
Instead PEAR2\RouterOS
should be PEAR2\Net\RouterOS.
boenrobot commented
Glad you figured it out ^_^ .