telegram-bot-sdk / standalone-starter

Standalone Starter for Telegram Bot SDK

Home Page:https://telegram-bot-sdk.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

telegram() not working because of outdated phpdotenv version

yongkyali opened this issue · comments

  • Library Version: master
  • PHP Version: 7.4

Description
Usage of telegram() in the template will always produce error Fatal error: Uncaught Error: Call to undefined method Dotenv\Repository\RepositoryBuilder::createWithDefaultAdapters() in /project/path/vendor/illuminate/support/Env.php:55 with .env file usage.

Steps To Reproduce

  • clone the template
  • run composer install
  • use telegram() within any files with .env being set up.

Possible Solution
It's because "illuminate/support": "6 - 8" on core SDK require vlucas/phpdotenv v5 to work properly. The temporary fix is to bump vlucas/phpdotenv library to ^v5.1 on this template composer.json.

Dotenv\Repository\RepositoryBuilder::createWithDefaultAdapters() method only exist in v5 and above in vlucas/phpdotenv.

Additional Context
Since this is only temporary solution, is there any better way to prevent bug like this? Or this bug should be fixed from core SDK project?

Since this is just a starter template, we need not support older versions.

We'll stick to latest version always, so 5.x is good as that way composer will pull the compatible versions of the illuminate packages the SDK depends on. Your PR is good, thanks 👍