Download the PHP package reysa/discord-api without Composer
On this page you can find all versions of the php package reysa/discord-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package discord-api
Reysa Discord API (v1)
A small Laravel helper package for working with parts of the Discord HTTP API.
Note: This is version 1 of the package. It does not cover all Discord API endpoints yet.
More endpoints and features will be added in future versions.
Official Discord API documentation:
https://discord.com/developers/docs/intro
Features (v1)
Currently supported helpers:
- Get guild invites
- Delete a guild invite
- Get a single message from a channel
- Get a guild member
- Get guild roles
- Give one or multiple roles to a user
- Remove one or multiple roles from a user
- Set a member nickname
- Send a direct message to a user
- Send an embed-style payload to a user
- Send a message/payload to a channel
- Get a single message from a channel
- Get recent messages from a channel
- Edit an existing message’s embeds in a channel
Requirements
Check composer.json for exact constraints, but the package is designed to work with:
- PHP:
>= 8.2 - Laravel:
7.xup to11.x(viailluminate/support^7.0|^8.0|^9.0|^10.0|^11.0)
Installation
Install the package via Composer:
composer require reysa/discord-api
Laravel’s package auto-discovery will automatically register the service provider and facade.
You can also find the package on Packagist:
https://packagist.org/packages/reysa/discord-api
Configuration
Publish the config file:
php artisan vendor:publish --tag=discord-api-config
This will create config/discord-api.php in your Laravel application:
sendEmbedMessageToUser(string $userId, array $payload): Response|false
Send a rich embed (or any valid Discord message payload) to a user via DM.
$payloadis sent as-is to the Discord API.- Example payload:
['embeds' => [...]] - Returns
falseif DM channel creation fails.
$payload = [
'content' => 'Optional text',
'embeds' => [
[
'title' => 'Hello!',
'description' => 'This is an embed message',
'color' => 0x7289DA,
],
],
];
DAPI::sendEmbedMessageToUser($userId, $payload);
sendMessageToChannel(string $channelId, array $payload): Response
Send a message to a specific channel.
$payloadcan be:['content' => 'plain text']- or a more complex structure (embeds, components, etc.).
DAPI::sendMessageToChannel('123456789012345678', [
'content' => 'Hello channel!',
]);
getChannelMessage(string $channelId, string $messageId): Response
Retrieve a single message from a given channel.
$message = DAPI::getChannelMessage($channelId, $messageId);
getChannelMessages(string $channelId): Response
Retrieve recent messages from a given channel.
$messages = DAPI::getChannelMessages($channelId);
editChannelEmbedMessage(string $channelId, string $messageId, array $embeds): Response
Edit an existing message’s embeds in a channel.
DAPI::editChannelEmbedMessage($channelId, $messageId, [
[
'title' => 'Updated title',
'description' => 'Updated description',
],
]);
Versioning & Roadmap
- Current version:
v1 - Scope: A small subset of Discord’s HTTP API focused on guild members, roles, invites, and basic messaging.
- Planned: Future versions will add support for more Discord endpoints and higher-level helpers.
Contributing
Issues and pull requests are welcome.
- Feel free to open an issue with:
- API endpoints you’d like to see supported
- Bug reports
- Ideas for improving developer experience (DX)
License
This project is open-source software licensed under the MIT license.
See the LICENSE file for details.