kodeops/laravel-telegram-wrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kodeops/laravel-telegram-wrapper

Composer 安装命令:

composer require kodeops/laravel-telegram-wrapper

包简介

Laravel Telegram API wrapper.

README 文档

README

 _     _  _____  ______  _______  _____   _____  _______
 |____/  |     | |     \ |______ |     | |_____] |______
 |    \_ |_____| |_____/ |______ |_____| |       ______|
 

Laravel Telegram API Wrapper

This package is a wrapper for the Telegram API.

Install composer dependency

$ composer require kodeops/laravel-telegram-wrapper

Setup logging

Add a new channel in logging.php config file:

'telegram' => [
    'driver' => 'single',
    'path' => storage_path('logs/telegram.log'),
    'level' => 'info',
],

Add environment settings

These would be used by default, additionally you can pass the credentials when instantiating the object.

TELEGRAM_DEBUG=false
TELEGRAM_BOT_TOKEN=<token>
TELEGRAM_CHAT_ID=<chat_id>

Usage

Send a new message

use kodeops\LaravelTelegramWrapper\Telegram;

return (new Telegram())
    ->withMarkdown($markdown)
    ->sendMessage();

You can also specify the credentials (bot_token and chat_id) when instantiating the object.

use kodeops\LaravelTelegramWrapper\Telegram;

return (new Telegram($bot_token))
    ->chat($chat_id)
    ->withMarkdownImage($image)
    ->withKeyboard($keyboard)
    ->withMarkdown($markdown)
    ->sendMessage();

This produces a message with the image on top and uses the image for notification highlight.

use kodeops\LaravelTelegramWrapper\Telegram;

$keyboard = [
    'inline_keyboard' => [
        [
            [
                'text' => 'Text Button',
                'url' => 'https://tannhauser-gate.xyz',
            ],
        ]
    ]
];

$markdown = 'A simple *markdown* text';
$image = 'https://iibusiness.s3.eu-central-1.amazonaws.com/tannhauser/favicon.jpg';

return (new Telegram())
    ->withKeyboard($keyboard)
    ->withMarkdownCaption($markdown)
    ->sendPhoto($image);

Options for sending messages:

  • disableWebPagePreview(): Disables link previews for links in this message

  • withKeyboard($keyboard): Sets the keyboard for a message

  • withMarkdown($markdown): Sets the markdown text

  • withMarkdownImage($image): Sets an image to the message using markdown

  • withMarkdownCaption($markdown): Sets a markdown text as a caption (useful in combination with sendPhoto($image))

Utils

  • setMyCommands($commands): set bot commands

  • setWebhook($url): set webhooks url More info on webhooks

  • getWebhookInfo(): get webhooks info

Additional features

In general you can use setParam($key, $value) method to add parameters to the request.

kodeops/laravel-telegram-wrapper 适用场景与选型建议

kodeops/laravel-telegram-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 735 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「laravel」 「telegram」 「kodeops」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kodeops/laravel-telegram-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kodeops/laravel-telegram-wrapper 我们能提供哪些服务?
定制开发 / 二次开发

基于 kodeops/laravel-telegram-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-08