2017 © Pedro Peláez
 

symfony-bundle telegram-bot-api-bundle

A simple wrapper for telegram-bot-api.

image

shaygan/telegram-bot-api-bundle

A simple wrapper for telegram-bot-api.

  • Saturday, February 4, 2017
  • by imangh
  • Repository
  • 2 Watchers
  • 24 Stars
  • 2,514 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 3 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

ShayganTelegramBotApiBundle

A symfony wrapper bundle for Telegram Bot API with some tiny feature., (*1)

Install

Via Composer, (*2)

``` bash $ composer require shaygan/telegram-bot-api-bundle @dev, (*3)


Edit your app/AppKernel.php to register the bundle in the registerBundles() method as above: ```php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... // register the bundle here new \Shaygan\TelegramBotApiBundle\ShayganTelegramBotApiBundle() ); } }

Configure the bundle

This bundle was designed to just work out of the box. The only thing you have to configure in order to get this bundle up and running is your bot token., (*4)

# app/config/config.yml

shaygan_telegram_bot_api:
    token: xxxxx:yyyyyyyyyyyyyyyyyyyy

If you want to use web-hook, add the bundle's routing configuration in app/config/routing.yml :, (*5)

shaygan_telegram_bot_api:
    resource: @ShayganTelegramBotApiBundle/Resources/config/routing.yml

And add your domain name, url prefix (if needed) and you update receiver service name (a sample update receiver is included) to the configuration file:, (*6)

# app/config/config.yml

shaygan_telegram_bot_api:
    #...
    webhook:
        domain: example.com
        path_prefix: ~ # you can add prefix, if your web site is not on the root
        update_receiver: shaygan.my_update_receiver # sample update receiver

note: Telegram do not support http, your site should have valid SSL (HTTPS)., (*7)

Usage

Wherever you have access to the service container :, (*8)

container->get('shaygan.telegram_bot_api');

    // test the API by calling getMe method
    $user = $api->getMe();

?>

Next...

Please refer to Telegram Bot API Official Document for getting infomration about available methods and other informations:, (*9)

Troubleshooting

If you did all the configurations correctly but still getting errors (Http error 500) even on getMe method, it might be because of SSL Verification. Please make sure you have up-to-date CA root certificate bundle to be used with cURL., (*10)

You can configure you CA root certificate bundle by:, (*11)

  1. Downloading up-to-date cacert.pem file from cURL website and
  2. Setting a path to it in your php.ini file, e.g. on Windows:, (*12)

    curl.cainfo=c:\php\cacert.pem, (*13)

License

The MIT License (MIT). Please see License File for more information., (*14)

The Versions

04/02 2017

dev-master

9999999-dev http://i-gh.ir

A simple wrapper for telegram-bot-api.

  Sources   Download

MIT

The Requires

 

api php symfony2 bot symfony3 symfony telegram telegram-bot-api