Download the PHP
package team-reflex/discord-php without Composer
On this page you can find all versions of the php package
team-reflex/discord-php. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor team-reflex Package discord-php Short Description An unofficial API to interact with the voice and text service Discord. License
MIT
FAQ
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
A wrapper for the official Discord REST, gateway and voice APIs. Documentation is available here, albeit limited at the moment, as well as a class reference. Feel free to ask questions in the Discord server above.
For testing and stability it would be greatly appreciated if you were able to add our test bot to your server. We don't store any data - the bot simply idles and does not interact with anyone and is used to test stability with large numbers of guilds. You can invite the bot here.
Cache Interface (experimental)
Warning
This branch contains an experimental feature, do not use it in production! See the wiki page for more information on how to set it up.
FAQ
Can I run DiscordPHP on a webserver (e.g. Apache, nginx)?
No, DiscordPHP will only run in CLI. If you want to have an interface for your bot you can integrate react/http with your bot and run it through CLI.
PHP is running out of memory?
Try unlimit your PHP memory using ini_set('memory_limit', '-1');.
Framework Integrations
While DiscordPHP is framework-agnostic and designed to run directly in CLI environments, there are community-maintained integrations available for popular frameworks:
laracord/laracord — A Laravel integration for DiscordPHP, providing service container bindings, configuration helpers, and a more Laravel-native development experience.
Laracord is maintained independently and is not part of the DiscordPHP core project.
Getting Started
Before you start using this Library, you need to know how PHP, Event Loops, and Promises work. This is a fundamental requirement before you start. Without this knowledge, you will only suffer.
Unfortunately PHP on Windows does not have access to the Windows Certificate Store. This is an issue because TLS gets used and as such certificate verification gets applied (turning this off is not an option).
You will notice this issue by your script exiting immediately after one loop turn without any errors.
As such users of this library need to download a Certificate Authority extract from the cURL website.
The path to the caextract must be set in the php.ini for openssl.cafile.
Run composer require team-reflex/discord-php. This will install the latest stable release.
If you would like, you can also install the development branch by running composer require team-reflex/discord-php dev-master.
Include the Composer autoload file at the top of your main file:
include __DIR__.'/vendor/autoload.php';
Make a bot!
Basic Example
See examples folder for more.
Documentation
Documentation for the latest version can be found wiki.
Contributing
We are open to contributions. However, please make sure you follow our coding standards (PSR-4 autoloading and custom styling). Please run php-cs-fixer before opening a pull request by running composer run-script cs.
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package team-reflex/discord-php contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.