Download the PHP package louisgjbertrand/discordwebhook without Composer
On this page you can find all versions of the php package louisgjbertrand/discordwebhook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package discordwebhook
Discord Webhook Sender
A simple & lightweight webhook sender.
Based on the code from this Stack exchange answer, this library is a lightweight Discord Webhook Event Sender that comes with two main functions.
Installation
run the following command in your project
Usage
Requirements
the buit-in CURL Library is required. please uncomment the curl library in your php.ini file
require the class in the php script you need it in.
Sending the event
you just have to use the Send function to send a message. only the url is required in this function.
you can use a pointer to store the json response from the discord api using the response param.
not all parameters are supported in the current state, but will be added later. It's mapping the discord webhook api.
note: tts is text to speech.
Generating embeded messages
you can create an array in order to create an embeded message using this function
putting the embeded message in an array is necessary since it's asked in the discord webhook documentation. the maximum embeded messages by webhook events is 10.
the function, to generate an embeded message follows the discord documentation.
in the future, arrays will be replaced by discord api objects but will still remain retro compatible.
Example Script
you can find this example script in the tests/ folder.
Notes
this library does not use ssl verification for curl by default. Please set the secure flag in the static variable DiscordWebhook::$SECURE_CURL_CONNECTION
to true in order to use SSL verification for CURL.
External Ressources
1 - composer documentation 2 - Discord Webhook Documentation 3 - Discord Embeded Message Documentation 4 - Stack Exchange Discord Webhook Original Post