radyakaze/telebot
最新稳定版本:0.1
Composer 安装命令:
composer require radyakaze/telebot
包简介
TeleBot - Simple PHP Telegram Bot
README 文档
README
This package is deprecated, please use PHPTelebot instead of. It's newer and better.
TeleBot - PHP Telegram Bot
A Simple Telegram Bot based on the official Telegram Bot API
Requirements
- PHP 5.3+
- Telegram Bot API Access Token - Talk to @BotFather and generate one. Documentation.
Installation
Install Through Composer
You can either add the package directly by firing this command
$ composer require radyakaze/telebot
Usage
You must set WebHook
Create set.php and put:
<?php $token = 'BOT TOKEN'; $botname = 'BOT USERNAME'; require __DIR__.'/vendor/autoload.php'; $tg = new TeleBot\Api($token, $botname); $tg->setWebhook('https://domain/path_to_hook.php');
And open your set.php via browser
After create hook.php and put:
<?php $token = 'BOT TOKEN'; $botname = 'BOT USERNAME'; require __DIR__.'/vendor/autoload.php'; $tg = new TeleBot\Api($token, $botname); // Simple command : /hello => Hello world! $tg->cmd('hello', 'Hello world!'); // Simple command with parameter : /echo telebot => telebot $tg->cmd('echo', function($text){ if (isset($text)) { return $text; } else { return '/echo <text>'; } }); $tg->run();
Send Photo
$tg->cmd('upload', array( 'type' => 'photo', 'send' => 'path/to/photo.jpg' ); // OR $tg->cmd('upload2', function($text) { return array( 'type' => 'photo', 'send' => 'path/to/photo.jpg' ) });
Send Location
<?php $tg->cmd('myloc', function($text) { return array( 'type' => 'location', 'send' => array(-7.61, 109.51) // Gombong, Kebumen, Indonesia, you can integrate with google maps api ) });
Avaible Types
- text, optional: web_preview (default: true)
- photo, optional: caption
- video, optional: caption
- document
- audio
- location, required: send as array($latitude, $longitude)
License
TeleBot is under the MIT License
Credits
Created by Radya.
radyakaze/telebot 适用场景与选型建议
radyakaze/telebot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 154 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「bot」 「telegram」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 radyakaze/telebot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 radyakaze/telebot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 radyakaze/telebot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dialogflow php sdk
Laravel 5.6 Monolog custom telegram channel
A PSR-7 compatible library for making CRUD API endpoints
VK driver for botman
Telegram bot integration with laravel
IRC bot for li3.
统计信息
- 总下载量: 154
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-17