https://github.com/ccaglayan/discord-webhooks-php
https://github.com/ccaglayan/discord-webhooks-php
discord discord-webhook-api discord-webhook-notifications discord-webhooks php webhook webhooks
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ccaglayan/discord-webhooks-php
- Owner: ccaglayan
- License: unlicense
- Created: 2018-12-21T14:28:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-11T21:30:31.000Z (over 7 years ago)
- Last Synced: 2025-10-25T09:35:55.363Z (8 months ago)
- Topics: discord, discord-webhook-api, discord-webhook-notifications, discord-webhooks, php, webhook, webhooks
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DiscordWebhooksPHP
[](https://app.codacy.com/app/ccaglayan/discord-webhooks-php?utm_source=github.com&utm_medium=referral&utm_content=ccaglayan/discord-webhooks-php&utm_campaign=Badge_Grade_Dashboard)
Discord webhooks is a simple client for Discord's webhook API.
#### Composer require command
`composer require ccaglayan/discord-webhooks-php`
## Usage
It is fairly easy to use. I'll throw in an example.
```php
use DiscordWebhooksPHP\Client;
$client = new Client('DISCORD_WEBHOOK_URL');
try{
$embedData = array(
"author" => array(
"name" =>"NAME",
"url" => "WEB_URL",
"icon_url" => "ICON_URL"
),
"title" => "Title",
"url" => "WEB_URL",
"description" => "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
"color" => 15258703,
"fields" => array(
array(
"name" => "Text",
"value" => "More text",
"inline" => true
),
array(
"name" => "Text",
"value" => "More text",
"inline" => true
),
array(
"name" => "Even more text",
"value" => "Yup",
"inline" => true
),
array(
"name" => "Use `\"inline\" => true` parameter, if you want to display fields in the same line.",
"value" => "okay..."
),
array(
"name" => "Thanks!",
"value" => "You're welcome :wink:"
)
),
"thumbnail" => array(
"url" => "THUMBNAIL_URL"
),
"image" => array(
"url" => "IMAGE_URL"
),
"footer" => array(
"text" => "Woah! So cool! :smirk:",
"icon_url" => "ICON_URL"
)
);
$client->setAvatar('AVATAR_URL'); // Optional
$client->setUsername('BOT_NAME'); // Optional
$client->setMessage('MESSAGE');
$client->setEmbedData($embedData); //Optional
$client->send();
}catch(\DiscordWebhooksPHP\DiscordException $e) {
echo 'Error:'.$e->getMessage().'--'.$e->getCode();
exit;
}
```
## Contributing
Pull requests and issues are open!