定制 peyman-manteali/telegram-notifier 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

peyman-manteali/telegram-notifier

最新稳定版本:1.0.0

Composer 安装命令:

composer require peyman-manteali/telegram-notifier

包简介

A simple Laravel package to send messages to Telegram using the Telegram Bot API.

README 文档

README

Telegram Notifier is a Laravel package for sending messages to Telegram via the Telegram Bot API. This package provides an easy way to integrate Telegram notifications in your Laravel application.

Requirements

  • PHP 8.0 or higher
  • Laravel 11
  • Guzzle HTTP client

Installation

To install the package, use Composer:

composer require peyman-manteali/telegram-notifier

Usage

After installation, you can use the Telegram class to send messages to a Telegram chat.

Example

use TelegramNotifier\Telegram;

$message = "Hello, this is a test message!";
$botToken = "your_bot_token";
$chatId = "your_chat_id";

// Optional: specify the parse mode (HTML, Markdown, MarkdownV2)
$parseMode = "HTML";

$response = Telegram::sendMessage($message, $botToken, $chatId, $parseMode);

Parameters

  • $message: The message text to send to Telegram.

  • $botToken: Your Telegram bot token.

  • $chatId: The chat ID where the message should be sent.

  • $parseMode (optional): Defines the formatting style for the message. Supported values are:

    • HTML
    • Markdown
    • MarkdownV2

Error Handling

If an error occurs while sending the message, the function will return a JSON response with the error message and a 500 status code.

License

This package is open-source and licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-13