承接 iwh3n/tgram 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iwh3n/tgram

最新稳定版本:v2.0.1

Composer 安装命令:

composer require iwh3n/tgram

包简介

CLI tool to run your Telegram bot locally without Webhooks

README 文档

README

CLI tool to run your Telegram bot locally without Webhooks

TGram allows you to test your Telegram bots locally without exposing a public webhook. It fetches updates from Telegram using long polling and forwards them to your local bot endpoint so you can develop, debug, and test your bot easily.

✨ Features

  • Receive Telegram updates on local environments.
  • Works for bots using webhooks, no public URL required.
  • Easy configuration using YAML.
  • CLI interface powered by Symfony Console.
  • Support for multiple bots simultaneously.
  • Real-time logs for debugging and monitoring.

💻 Installation

Make sure you have PHP >= 8.2 and Composer installed.

Linux / macOS

composer global require iwh3n/tgram
export PATH="$(composer global config bin-dir --absolute | tail -n1):$PATH"  # session-only

⚠️ This adds TGram only for the current terminal session. To make it permanent, enter the following commands:

COMPOSER_GLOBAL_BIN=$(composer global config bin-dir --absolute)

# for bash:
echo "export PATH=\"\$PATH:$COMPOSER_GLOBAL_BIN\"" >> ~/.bashrc
source ./.bashrc

# for zsh:
echo "export PATH=\"\$PATH:$COMPOSER_GLOBAL_BIN\"" >> ~/.zshrc
source ./.zshrc

Windows (PowerShell)

composer global require iwh3n/tgram
$env:PATH = "$(composer global config bin-dir --absolute | Select-Object -Last 1);$env:PATH"  # session-only

⚠️ This adds TGram only for the current PowerShell session. To make it permanent, use:

setx PATH "$($env:APPDATA)\Composer\vendor\bin;$env:PATH"

Then restart your PowerShell.

Verify installation:

tgram --version

⚙️ Quick Start

  1. Initialize configuration
tgram init

Example tgram.yaml:

bot:
  token: "123456789:ABCDEF..."
  endpoint: "http://localhost:8000/bot"
  1. Run TGram
tgram run

TGram will start long polling Telegram and forward updates to your local endpoint.

  1. Stop TGram
CTRL+C

🛠 Example Workflow

# Initialize config
tgram init

# Run bot
tgram run

Now any message sent to your bot will be received by your local development server at the endpoint you configured.

⚙️ Configuration Options

  • token – Telegram bot token.
  • endpoint – Local URL where your bot script listens.

📊 How It Works

Telegram Server → [Long Polling] → TGram CLI → Your Local Bot
  1. Telegram sends updates → TGram CLI grabs them.
  2. TGram forwards updates → Your local bot endpoint.
  3. You can debug, log, and test locally.

Made with ❤️ by H O S S E I N

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固