承接 symfony/discord-notifier 相关项目开发

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

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

symfony/discord-notifier

最新稳定版本:v8.0.0

Composer 安装命令:

composer require symfony/discord-notifier

包简介

Symfony Discord Notifier Bridge

README 文档

README

Provides Discord integration for Symfony Notifier.

DSN example

DISCORD_DSN=discord://TOKEN@default?webhook_id=ID

where:

  • TOKEN the secure token of the webhook (returned for Incoming Webhooks)
  • ID the id of the webhook

Adding Interactions to a Message

With a Discord message, you can use the DiscordOptions class to add some interactive options called Embed elements.

use Symfony\Component\Notifier\Bridge\Discord\DiscordOptions;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordEmbed;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFieldEmbedObject;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordFooterEmbedObject;
use Symfony\Component\Notifier\Bridge\Discord\Embeds\DiscordMediaEmbedObject;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create Discord Embed
$discordOptions = (new DiscordOptions())
    ->username('connor bot')
    ->addEmbed((new DiscordEmbed())
        ->color(2021216)
        ->title('New song added!')
        ->thumbnail((new DiscordMediaEmbedObject())
        ->url('https://i.scdn.co/image/ab67616d0000b2735eb27502aa5cb1b4c9db426b'))
        ->addField((new DiscordFieldEmbedObject())
            ->name('Track')
            ->value('[Common Ground](https://open.spotify.com/track/36TYfGWUhIRlVjM8TxGUK6)')
            ->inline(true)
        )
        ->addField((new DiscordFieldEmbedObject())
            ->name('Artist')
            ->value('Alasdair Fraser')
            ->inline(true)
        )
        ->addField((new DiscordFieldEmbedObject())
            ->name('Album')
            ->value('Dawn Dance')
            ->inline(true)
        )
        ->footer((new DiscordFooterEmbedObject())
            ->text('Added ...')
            ->iconUrl('https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Spotify_logo_without_text.svg/200px-Spotify_logo_without_text.svg.png')
        )
    )
;

    // Add the custom options to the chat message and send the message
    $chatMessage->options($discordOptions);

    $chatter->send($chatMessage);

Resources

统计信息

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

GitHub 信息

  • Stars: 36
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04