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!
Dependences
- PHP ^7.1 | ^8.0
- Webhook Link (Discord Doc)
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
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-18