maxgorovenko / telegram-bot-api
A wrapper for Telegram Bot API
dev-master
2016-05-29 21:41 UTC
Requires
- php: ^5.3.3 || ^7.0
- jms/serializer-bundle: ^1.1
This package is not auto-updated.
Last update: 2024-04-27 16:09:09 UTC
README
A wrapper bundle for Telegram Bot API compatible with Symfony framework. Uses JMS\Serializer for serialization and deserialization objects.
Install
Via Composer
$ composer require maxgorovenko/telegram-bot-api-bundle @dev
For Symfony you have to upgrade your AppKernel and config:
# app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... // register the bundle here new \MG\TelegramBotApiBundle\MGTelegramBotApiBundle() ); } }
# app/config/config.yml mg_telegram_bot_api: token: xxxxx:yyyyyyyyyyyyyyyyyyyy
Usage
Simple
Look in JMS Serializer creating manual.
$botToken = '11111:2222222'; $serializer = JMS\Serializer\SerializerBuilder::create()->build(); $api = new MG\TelegramBotApiBundle\Service\Api($botToken, $serializer); $updates = $api->getUpdates();
With symfony
$api = $container->get('mg.telegram_bot_api'); $updates = $api->getUpdates();