-
Notifications
You must be signed in to change notification settings - Fork 238
Intro
DiscordPHP is a wrapper for the Discord REST, WebSocket and Voice APIs. Built on top of ReactPHP components. This documentation is based off the latest release.
This documentation page will be moved to class reference. You can now access it here.
- PHP 8.0 CLI
- Will not run on a webserver (FPM, CGI), you must run through CLI. A bot is a long-running process.
- x86 (32-bit) PHP requires ext-gmp extension enabled for handling new Permission values.
-
ext-json
for JSON parsing. -
ext-zlib
for gateway packet compression.
- One of
ext-uv
,ext-libev
orevt-event
(in order of preference) for a faster, and more performant event loop. -
ext-mbstring
if you may handle non-english characters. -
ext-gmp
if running 32-bit PHP.
- x86_64 Windows, Linux or Darwin based OS.
- If you are running on Windows, you must be using PHP 8.0.
-
ext-sodium
for voice encryption. - FFmpeg
We recommend using an editor with support for the Language Server Protocol. A list of supported editors can be found here. Here are some commonly used editors:
- Visual Studio Code (built-in LSP support)
- Vim/Neovim (with the coc.nvim plugin for LSP support)
- PHPStorm (built-in PHP support)
We recommend installing PHP Intelephense alongside your LSP-equipped editor for code completion alongside other helpful features. There is no need to pay for the premium features, the free version will suffice.
Installation requries Composer.
To install the latest release:
> composer require team-reflex/discord-php
If you would like to run on the latest master
branch:
> composer require team-reflex/discord-php dev-master
master
can be substituted for any other branch name to install that branch.
As Discord is a real-time application, events come frequently and it is vital that your code does not block the ReactPHP event loop. Most, if not all, functions return promises, therefore it is vital that you understand the concept of asynchronous programming with promises. You can learn more about ReactPHP promises here.
If you need any help, feel free to join the PHP Discorders Discord and someone should be able to give you a hand. We are a small community so please be patient if someone can't help you straight away.
All contributions are welcome through pull requests in our GitHub repository. At the moment we would love contributions towards:
- Unit testing
- Documentation
Note: This wiki is currently Work In Progress. Consider reading the docs instead.
- Application Command (Slash based)
Command Client (Message based)
- Activity
- Application
- Guild
- Private Channel
- User
Components
-
ActionRow
- Buttons
- Option (commands)
- SelectMenu
- TextInput
Builders