Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Class "Hybridauth\\Hybridauth\\Provider\\Telegram" not found #1356

Open
Mo45 opened this issue Dec 8, 2022 · 2 comments
Open

Comments

@Mo45
Copy link

Mo45 commented Dec 8, 2022

Hello there. Trying to use new (to me) v3.8.2. But can't use it with Telegram provider.

PHP Fatal error: Uncaught Error: Class "Hybridauth\\Hybridauth\\Provider\\Telegram" not found in /var/some/www/index.php:20\nStack trace:\n#0 {main}\n thrown in /var/some/www/index.php on line 20

In index.php i have these:

include_once( dirname( __FILE__ ) . '/hybridauth/autoload.php' );

use Hybridauth\Hybridauth;
use Hybridauth\HttpClient;
$config = ['callback' => HttpClient\Util::getCurrentUrl(),'keys' => ['id' => 'mybot', 'secret' => '123:somesecret'],];

$adapter = new Hybridauth\Provider\Telegram($config);
try {
$adapter->authenticate();
$userProfile = $adapter->getUserProfile();
} catch (\Exception $e) {
print $e->getMessage();
}

PHP Version 8.1.6

Also, i've have same error with HttpClient:
Uncaught Error: Class "Hybridauth\\Hybridauth\\HttpClient\\Util" not found
But when i changed this line:
'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(),
to
'callback' => HttpClient\Util::getCurrentUrl(),
error disappear.

@Mo45
Copy link
Author

Mo45 commented Dec 8, 2022

Fixed by adding slash before Hybridauth\Provider\Telegram($config);
In this line: $adapter = new \Hybridauth\Provider\Telegram($config);
Is this documentaion mistake or something wrong with my environment?

@RiverVanRain
Copy link
Contributor

This is a misuse of PHP.
Please learn more on Namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants