
And try to use this library in the controller but get an error "Error: Class "WeStacks\TeleBot\TeleBot" not found in /home/user/Coding/OC-Modules/x-telegram-notifications.loc/extension/x_telegram_notifications/catalog/controller/module/telegram_notifications.php on line 14".
Code of my controller:
Code: Select all
<?php
namespace Opencart\Catalog\Controller\Extension\XTelegramNotifications\Module;
use Opencart\System\Engine\Controller;
use WeStacks\TeleBot\TeleBot;
class TelegramNotifications extends Controller
{
public function index(): void
{
error_reporting(E_ALL);
ini_set('display_errors', '1');
$telebot = new TeleBot(['token' => $this->getToken()]);
}
private function getToken(): string
{
return 'token';
}
}

My question is what is right approach to use external libraries in the controllers? Thank you in advance!