naffiq / telegram-channel-php
轻松发布到您的Telegram频道!
v1.0.2
2018-04-23 08:25 UTC
Requires
- longman/telegram-bot: ^0.47.1
Requires (Dev)
- codeclimate/php-test-reporter: ^0.4.4
- phpunit/phpunit: 5.7
- vlucas/phpdotenv: ^2.4
This package is auto-updated.
Last update: 2024-09-23 01:15:24 UTC
README
这个小巧的库(仅一个类!)可以帮助您通过机器人将消息推送到您的Telegram频道。
安装
为了安装,请使用composer
$ composer require naffiq/telegram-channel-php
用法
- 通过 BotFather 创建机器人并从其中获取
BOT_TOKEN
- 将其添加为管理员到您的频道
- 按照以下示例发布消息或照片
发布消息
<?php $manager = new \naffiq\telegram\channel\Manager(BOT_TOKEN, CHANNEL_NAME); $manager->postMessage('Hello, fellas!');
发布照片
<?php $manager = new \naffiq\telegram\channel\Manager(BOT_TOKEN, CHANNEL_NAME); $manager->postPhoto(__DIR__ . '/photo.jpeg', 'Put your label here');