php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.9k stars 955 forks source link

Laravel integration #797

Closed MyZik closed 5 years ago

MyZik commented 6 years ago

Hi everyone! I want to use lib inside of clear Laravel project. And I have some questions about that.

  1. What should my routes file (/routes/web.php) look like? To set webhook, commands path, commands handler, etc.
  2. Where can I create my commands Controller? And what name should I use? SurveyCommandController.php?
  3. What should the command Controller look like? For example, I need a survey command, should I use execute method in my Controller?
akalongman commented 6 years ago

@MyZik I plan to add Laravel integration to this package, but before

What should my routes file (/routes/web.php) look like? To set webhook, commands path, commands handler, etc.

Its everything up to you, you are not limited.

Where can I create my commands Controller? And what name should I use? SurveyCommandController.php?

Same here. just create TelegramController and add methods mapped to routes, or create separate controllers for each command.

What should the command Controller look like? For example, I need a survey command, should I use execute method in my Controller?

Yes

MyZik commented 6 years ago

@akalongman thanks for your answer. Still there is no full Laravel-support of the library? It seems to me that a separate package would look cool

sergey89d commented 6 years ago

i found this https://github.com/irazasyed/telegram-bot-sdk

akalongman commented 6 years ago

Official Laravel integration for this library will be added soon

MBoretto commented 6 years ago

@akalongman How you think to integrate the database migrations in the laravel framework? @MyZik https://github.com/MBoretto/Nostickers

akalongman commented 6 years ago

@MBoretto I am still thinking about that

ranrinc commented 6 years ago

@akalongman I hope the package will come in soon... wanted to do it badly.. hahahaha

akalongman commented 6 years ago

@ranrinc yes, yes. Do you want to help with testing?

ranrinc commented 6 years ago

@akalongman for sure... YES!!!

akalongman commented 6 years ago

Ok guys, here we go https://github.com/php-telegram-bot/laravel

Do not forget that its pre-release and may be bugs :) Please help us in testing and let us know what we should fix or improve