承接 westacks/telebot-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

westacks/telebot-laravel

Composer 安装命令:

composer require westacks/telebot-laravel

包简介

Telebot adapter for Laravel

README 文档

README

Stand With Ukraine

Project Logo

Latest Stable Version Total Downloads License Pest

TeleBot is a PHP library for telegram bots development. This project is a Laravel adapter for TeleBot

Installation

Install the package with composer:

composer require westacks/telebot-laravel

Complete setup with the following command:

php artisan telebot:install

Farther steps

Documentation for the library can be found on the website.

Features

Laravel Support

Library provides a Facade, artisan commands and notification channel to simplify the development process of your bot, if you are using Laravel:

Laravel Boost Skill

This package ships with a Laravel Boost skill. Install it via:

php artisan boost:add-skill westacks/telebot-laravel
Facade
TeleBot::getMe();
TeleBot::bot('bot2')->getMe();
Creating update handlers

You can create different types of update handlers or bot kernel with the following command:

$ php artisan make:telebot:kernel
$ php artisan make:telebot:update-handler
$ php artisan make:telebot:command-handler
$ php artisan make:telebot:callback-handler
$ php artisan make:telebot:input-handler
Automatic webhook generation

After you insert your bot token, to create a webhook you need only to fire the following command:

$ php artisan telebot:webhook --setup

Route for handling updates is generated automatically for your APP_URL

Long polling

If you are not using webhook, or want to use bot in local or test environment, you may start long polling by only firyng this command:

$ php artisan telebot:polling
Setup commands autocompletion

The following command will automatically setup autocompletion for all registered bot commands on Telegram servers:

$ php artisan telebot:commands --setup
Notification channel
<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use WeStacks\TeleBot\Laravel\TelegramNotification;

class TelegramNotification extends Notification
{
    public function via($notifiable)
    {
        return ['telegram'];
    }

    public function toTelegram($notifiable)
    {
        return (new TelegramNotification)->bot('bot')
            ->sendMessage([
                'chat_id' => $notifiable->telegram_chat_id,
                'text'    => 'Hello, from Laravel\'s notifications!'
            ])
            ->sendMessage([
                'chat_id' => $notifiable->telegram_chat_id,
                'text'    => 'Second message'
            ]);
    }
}
Log driver

You may log your application errors by sending them to some Telegram chat. Simply add new log driver to a config/logging.php:

'telegram' => [
    'driver'    => 'custom',
    'via'       => \WeStacks\TeleBot\Laravel\Log\TelegramLogger::class,
    'level'     => 'debug',
    'bot'       => 'bot',
    'chat_id'   => env('TELEGRAM_LOG_CHAT_ID') // Any chat where bot can write messages.
]

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

westacks/telebot-laravel 适用场景与选型建议

westacks/telebot-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.99k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2023 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-15