---
agentTools:
  projectIndex: https://telegram-bot-sdk.readme.io/llms.txt
---

# Initial Setup

Basic Setup Instructions

All the methods listed on [Telegram Bot API](https://core.telegram.org/bots/api) page are fully supported by this SDK.

# Standalone Setup

In order to use the library in your project, You need to install the SDK with Composer. Refer the [Getting Started](https://telegram-bot-sdk.readme.io/docs/getting-started) page for more details on how to install with Composer and autoload in your project.

## Initialize Library

The first​ step is to initialize the library. Once you do that, You'll get access to all the available API Methods to make requests to Telegram.

[block:code]
{
  "codes": [
    {
      "code": "use Telegram\\Bot\\Api;\n\n$telegram = new Api('BOT TOKEN');",
      "language": "php",
      "name": "Standalone"
    }
  ]
}
[/block]

# Laravel Setup

Open `telegram.php` the configuration file in `config` directory and set the `bot_token` with your Telegram's Bot Access Token or you could also set environment variable `TELEGRAM_BOT_TOKEN` with the appropriate value.
Refer the configuration file for other default configuration settings.

## Config Overview

Open the config file for detailed comments for each option.

Set your Telegram Bot Access Token in `bot_token` key **\[REQUIRED]**

[block:code]
{
  "codes": [
    {
      "code": "'bot_token' => '1234:ABCD'",
      "language": "php",
      "name": "telegram.php"
    }
  ]
}
[/block]

All other configs are optional, use as per your requirements.

## Test Bot

A simple method for testing your bot's auth token.
Returns basic information about the bot in form of a User object.

See [getMe](https://telegram-bot-sdk.readme.io/docs/getme) docs for more details.

[block:code]
{
  "codes": [
    {
      "code": "$response = $telegram->getMe();\n\n$botId = $response->getId();\n$firstName = $response->getFirstName();\n$username = $response->getUsername();",
      "language": "php",
      "name": "Standalone"
    },
    {
      "code": "$response = Telegram::getMe();\n\n$botId = $response->getId();\n$firstName = $response->getFirstName();\n$username = $response->getUsername();",
      "language": "php",
      "name": "Laravel"
    }
  ]
}
[/block]