Getting Started

This page will help you get started with Telegram Bot SDK. You'll be up and running in a jiffy!

Star the Repo Star the Project

3600

Join PHP Chat Chat on Telegram Build Status Latest Version Total Downloads

Telegram Bot API - PHP SDK

📘

Introduction

Telegram Bot SDK lets you develop Telegram Bots in PHP easily! Supports Laravel out of the box.

Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.

To learn more about the Telegram Bot API, please consult the Introduction to Bots and Bot FAQ on the official Telegram site.

Key Features of this SDK

  • No.1 SDK for PHP language.
  • Recommended by Telegram.
  • Multi-Bot Support.
  • Commands Handler System.
  • Easy to Get Started and Use.
  • Helper Methods to Ease Development.
  • Actively Maintained & Developed.
  • Complete API Methods Support.
  • Laravel Support out of the box!
  • Clean, Highly Documented & Industry Standard Code.
  • PSR Standards.
  • Popular & Widely Used.
  • Powered by Laravel Collection API for Response Objects.
  • Events / Plugin Support to Extend Features. (Coming Soon!)
  • Conversational Support. (Coming Soon!)
  • Well-Designed, Tested & Built.
  • Active support from the author as well as the community.
  • Live support in Slack chat.

Requirements

  • PHP 7.2+
  • Composer
  • Telegram Bot API Access Token - Talk to @BotFather and generate one.
  • Laravel >= 5.5+ or Lumen Installation (Optional only if you want to use it with either of these frameworks).

Installation

The recommended way to install the SDK is with Composer.

composer require irazasyed/telegram-bot-sdk ^2.0

Alternatively, you can specify the SDK as a dependency in your project's existing composer.json file:

{
    "require": {
      "irazasyed/telegram-bot-sdk": "^2.0"
    }
}

After installing, you need to require Composer's autoloader if you want to use the library standalone:

require 'vendor/autoload.php';

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Laravel Usage

If you're using this SDK with Laravel, the SDK will self-register its ServiceProvider and Facade using Laravel's auto-discovery.

Publish Configuration File

Open your terminal window and fire the following command to publish config file to your config directory:

php artisan vendor:publish --provider="Telegram\Bot\Laravel\TelegramServiceProvider"

Are You Using Telegram Bot SDK?

👍

Submit Your Bot!

If you're using this SDK to build your Telegram Bots, We'd love to know and share the bot with the world. Tell us about it - here

Check out the Who's Using Telegram Bot SDK wiki page to know more about what people have been building with this SDK.

Contributing

Thank you for considering contributing to the project. Please review the CONTRIBUTING guidelines before submitting any pull requests.

Credits

Thanks

Thanks to JetBrains for providing an open-source license to their PhpStorm IDE that has been very useful in developing this SDK. Please go check them out!

JetBrains

Disclaimer

This project and its author is neither associated nor affiliated with Telegram in any way.

See License section for more details.

License

This project is released under the BSD 3-Clause License.

📘

Additional Information

The library takes advantage of the amazing Laravel Collection API to automatically map the data.

So it's a lot easier to work with the array of data. Supports all the methods listed on the official docs.

Any issues, feedback, suggestions or questions please use issue tracker here.