matmper/php-discord-webhook 问题修复 & 功能扩展

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

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

matmper/php-discord-webhook

最新稳定版本:2.0.2

Composer 安装命令:

composer require matmper/php-discord-webhook

包简介

Sample and cleand package to send messages to your discord channel

README 文档

README

Sample and cleand package to send messages to your discord channel. Easily!

image

Dependences

Install & Usage

Install this repository in with composer:

$ composer require matmper/php-discord-webhook

Configure application envs values:

Applications without env files support, we recommend using version 1.x

# REQUIRED (https://discord.com/api/webhooks/{ID}/{TOKEN})
DISCORD_WEBHOOK_ID=
DISCORD_WEBHOOK_TOKEN=

# OPTIONAL (DEFAULT VALUE)
APP_NAME="no application"
APP_ENV="undefined"
DISCORD_WEBHOOK_BOT_NAME="Webhook BOT"

Send a message:

$sendWebhook = new \Matmper\DiscordWebhook();
$sendWebhook->message('message')->send();

Set custom Discord ID and Token and send a message:

$sendWebhook = new \Matmper\DiscordWebhook('DISCORD_ID', 'DISCORD_TOKEN');
$sendWebhook->message('message')->send();

Send a typed message:

use Matmper\Enums\MessageType;
$sendWebhook->type(MessageType::SUCCESS)->message('message')->send();
$sendWebhook->type(MessageType::WARNING)->message('message')->send();
$sendWebhook->type(MessageType::DANGER)->message('message')->send();
Value Enum Color
success MessageType::SUCCESS #2ecc71
warning MessageType::WARNING #e74c3c
danger MessageType::DANGER #f1c40f
default MessageType::DEFAULT #3498db

Contribution & Development

This is an open source code, free for distribution and contribution. All contributions will be accepted only with Pull Request and that pass the test and code standardization.

Run composer install in yout development and create env file

$ composer install --dev --prefer-dist
$ cp ./tests/.env.example .env

Edit ./tests/.env and configure envs values. Execute $ composer check.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-18