php-telegram-bot / laravel

Laravel package for PHP Telegram Bot Library
Other
171 stars 51 forks source link

Problem with install package #36

Closed amigolj closed 2 years ago

amigolj commented 3 years ago

Hi I try install package but I get this errors. Its fresh install only laravel and this package This my composer.json "require": { "php": "^7.3|^8.0", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.54", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5", "longman/telegram-bot": "^0.74.0", "php-telegram-bot/laravel": "^1.0" },

Problem 1

shaikhfoysal commented 3 years ago

Same problem. anybody or the package authors. Please help. Thanks.

noplanman commented 3 years ago

Update your composer.json to use the master branch, as there hasn't been a tagged version just yet.

"php-telegram-bot/laravel": "dev-master"
arminkit commented 2 years ago

Update your composer.json to use the master branch, as there hasn't been a tagged version just yet.

"php-telegram-bot/laravel": "dev-master"

Hi I get the following error in the " composer update "command. What is the problem? "laravel/framework": "^8.65",

`Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead. Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

Longman\TelegramBot\Exception\TelegramException

API KEY not defined!

at C:\xampp\htdocs\laravel8-bot\vendor\longman\telegram-bot\src\Telegram.php:210 206▕ */ 207▕ public function __construct(string $api_key, string $bot_username = '') 208▕ { 209▕ if (empty($api_key)) { ➜ 210▕ throw new TelegramException('API KEY not defined!'); 211▕ } 212▕ preg_match('/(\d+):[\w-]+/', $api_key, $matches); 213▕ if (!isset($matches[1])) { 214▕ throw new TelegramException('Invalid API KEY defined!');

1 C:\xampp\htdocs\laravel8-bot\vendor\php-telegram-bot\laravel\src\Laravel\ServiceProvider.php:61 Longman\TelegramBot\Telegram::__construct("", "")

2 C:\xampp\htdocs\laravel8-bot\vendor\laravel\framework\src\Illuminate\Container\Container.php:873 PhpTelegramBot\Laravel\ServiceProvider::PhpTelegramBot\Laravel{closure}(Object(Illuminate\Foundation\Application), []) Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1`

noplanman commented 2 years ago

@arminkit The warning about swiftmailer has nothing to do with this library, so that can be ignored for the sake of this issue.

Be sure to publish the config file: php artisan vendor:publish --provider="PhpTelegramBot\Laravel\ServiceProvider"

Then update your configuration in config/phptelegrambot.php and add the correct API key.

viiy commented 2 years ago

@arminkit add PHP_TELEGRAM_BOT_API_KEY= to your .env