Possibly. I could use help with this. So here's my philosophy:
A wrapper for the official Discord REST, gateway and voice APIs.
DiscordPHP is installed using Composer. Make sure you have installed Composer and are used to how it operates. We require a minimum PHP version of PHP 5.5.9, however it is reccomended that you use PHP 7. PHP 5.x support will be removed in the future.
This library has not been tested with HHVM.
composer require team-reflex/discord-php
. This will install the lastest release.
composer require team-reflex/discord-php dev-develop
.include __DIR__.'/vendor/autoload.php';
<?php
include __DIR__.'/vendor/autoload.php';
use Discord\Discord;
$discord = new Discord([
'token' => 'bot-token',
]);
$discord->on('ready', function ($discord) {
echo "Bot is ready!", PHP_EOL;
// Listen for messages.
$discord->on('message', function ($message, $discord) {
echo "{$message->author->username}: {$message->content}",PHP_EOL;
});
});
$discord->run();
ini_set('memory_limit', '200M')
to increase it to 200 mb. If you would like it to be unlimited, use ini_set('memory_limit', '-1')
.Raw documentation can be found in-line in the code and on the DiscordPHP Class Reference. More user friendly and examples will soon be coming on the DiscordPHP Wiki.
We are open to contributions. However, please make sure you follow our coding standards (PSR-4 autoloading and custom styling). We use StyleCI to format our code. Our StyleCI settings can be found here.
See this chart for a feature comparison and list of other Discord API libraries.