承接 davtur19/turibot 相关项目开发

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

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

davtur19/turibot

最新稳定版本:2.16

Composer 安装命令:

composer create-project davtur19/turibot

包简介

A simple way to communicate with Telegram APIs in PHP.

README 文档

README

TuriBot is a simple way to communicate with Telegram APIs in PHP

Latest Stable Version Total Downloads License

Requirements

Stable

PHP 8.0 or higher with curl extension

Beta (Async)

PHP 8.1 or higher, you need to install amp from composer

Installation

Stable

composer require davtur19/turibot 1.x

Beta (Async)

composer init --name=your.name/yourbot --no-interaction
composer config minimum-stability dev
composer require davtur19/turibot 2.x

Webhook

Setup recommended: open setupWebhook.php in your browser and follow the setup wizard.

Manual setup: set webhook to the file webhook.php, and as parameter GET "api" set your token.

Example for manual setup:

curl https://api.telegram.org/botTOKEN/setWebhook?url=https://WEBSITE/DIR/webhook.php?api=TOKEN

Alternatively if you don't want to use GET, just change this piece of code.

GetUpdates

Setup Token

Usage

  • Look at the examples (webhook.php and getUpdates.php), it's very simple if you know PHP and OOP
  • All methods have the parameters in the same order as the BotAPIs
  • The reply_markup, permissions, commands, entities and parameters that require arrays, already have a json_encode in the functions, you just need to pass arrays

Security

https://github.com/php-telegram-bot/core/wiki/Securing-&-Hardening-your-Telegram-Bot

Custom endpoint

With the Bot API 5.0 it is now possible to self host your own Bot API, here is an example of how to add your own endpoint

//token, json_payload, endpoint
$client = new Client("1234:AAbbccdd", false, "http://endpoint/bot");

Json payload

Only works with webhooks, for more info: https://core.telegram.org/bots/faq#how-can-i-make-requests-in-response-to-updates

I do not recommend using it as it may need a particular configuration to the webserver for flushing and you cannot get a response from the Bot API

Generator

https://github.com/davtur19/TuriBotGen

Contributors

Old version

I don't recommend its use, but it could be useful for those unfamiliar with OOP and would like to start learning how PHP and Telegram Bot Api work.

https://github.com/davtur19/TuriBot/tree/old

统计信息

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

GitHub 信息

  • Stars: 122
  • Watchers: 5
  • Forks: 31
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2019-04-17