承接 mmb/thunder 相关项目开发

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

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

mmb/thunder

Composer 安装命令:

composer require mmb/thunder

包简介

README 文档

README

What Is Thunder?

Thunder run a listener to the telegram and open some process in the background (grouped by Tagger), and then pass the updates to child processes.

That means the application is ready to handle updates! Doesn't need to load all packages, configs, service providers per each update.

Installation

Easily install using:

composer require mmb/thunder:dev-main

Commands

Start Command

To start the thunder service, run this command:

php artisan thunder:start

Or run it in background process:

php artisan thunder:start > /dev/null &

Stop Command

To stop the thunder service that running in the background, run this command:

php artisan thunder:stop

This command send a message to main thunder process and request to stop that. It may take a long time, because the main process is blocked for listening to Telegram. You can send a message to Telegram to make it faster XD.

Hot Reload

If you change a code, the thunder process will not refresh the process (actually this is the point of thunder to speeding up). But you can run the following command to kill and reload the processes.

php artisan thunder:hot-reload

Customize

Publish

Publish the config with following command:

php artisan vendor:publish --tag=thunder

Puncher

Puncher is the way to open new process for a tag and update.

'driver' => 'process',

Currently, only "process" driver is available.

Release is time to release a tagged process when no updates are available for that.

'release' => 180,

Tagger

Tagging is grouping the updates to handle by a separate process.

'tagger' => [
    'class' => Tagger\ChatTagger::class,
],

You can customize tagger:

class UserTagger implements Tagger
{
    public function tag(Update $update) : string
    {
        return $update->getUser()?->id ?? 'global';
    }
}

Sharing

Sharing is the way to main process and child process should connect to each other and send messages.

'driver' => 'pipe',

Currently, only "pipe" and "file" driver is available.

Hook

Hook is settings for listening for updates.

The "long" key is the timeout for "getUpdates" method in Telegram api. This parameter is time to wait by telegram until new update passed.

'long' => 60,

统计信息

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

GitHub 信息

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

其他信息

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