问题
I tried to use PHP telegram bot in my CakePHP 3 website, but encountered many problems.
done
I ran "composer require longman/telegram-bot" and copied package to "plugins" folder.
and then "bin/cake plugin load longman/telegram-bot".
questions
1. Where I must put the package and why? vendor or plugins
2. How to call package methods in URL?
I added "index" method to "telegram-bot/src/Telegram.php" and tried this snippet code in my "Template/Users/index.ctp".
echo $this->Html->link('telegram', ['plugin' => 'longman/telegram-bot', 'controller' => 'telegram', 'action' => 'index']);
that results
Error: A route matching "array ( 'plugin' => 'longman/telegram-bot', 'controller' => 'telegram', 'action' => 'index', '_ext' => NULL, )" could not be found.
3. What I must add to "routes.php"?
4. How can I use "telegram-bot/src/Telegram.php" methods in my controllers and models.
5. Is there anything else that must be observed?
Thanks.
来源:https://stackoverflow.com/questions/44106107/how-to-use-telegram-api-package-in-cakephp-3