naffiq/telegram-channel-php

轻松发布到您的Telegram频道!

v1.0.2 2018-04-23 08:25 UTC

This package is auto-updated.

Last update: 2024-09-23 01:15:24 UTC


README

Build Status Code Climate Test Coverage

这个小巧的库(仅一个类!)可以帮助您通过机器人将消息推送到您的Telegram频道。

安装

为了安装,请使用composer

$ composer require naffiq/telegram-channel-php

用法

  1. 通过 BotFather 创建机器人并从其中获取 BOT_TOKEN
  2. 将其添加为管理员到您的频道
  3. 按照以下示例发布消息或照片

发布消息

<?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');