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.

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.
Please rate this library. Is it a good library?

Informations about the package discord-api

Reysa Discord API

License: MIT PHP >= 8.2 Laravel 7-13+ Version 2.0.0

Call Discord's HTTP API from Laravel through simple static method calls instead of hand-rolling Guzzle/Http:: requests, headers, and URLs yourself:

v2 covers essentially every endpoint Discord officially documents for bots — Guilds, Channels, Messages, Users, Webhooks, Emojis, Stickers, Invites, Application Commands & Interactions, Audit Log, Auto Moderation, Scheduled Events, Stage Instances, Soundboard, Polls, Voice, Monetization, and OAuth2. Not covered: the Gateway (WebSocket real-time events) and the Discord Social SDK/Lobby endpoints — different protocol/product, outside the scope of an HTTP client wrapper.

Official Discord API documentation: https://discord.com/developers/docs/intro

Table of contents


What's new in v2


Requirements

Check composer.json for exact constraints, but the package is designed to work with:


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:


removeRole(string $userId, array $roleIds): Response[]

Remove one or multiple roles from a member.

// Remove a single role
$results = DAPI::removeRole($userId, [123456789012345678]);

// Remove multiple roles
$results = DAPI::removeRole($userId, [
    123456789012345678,
    234567890123456789,
]);

setName(string $userId, string $name): Response

Set the member's nickname in the configured guild.

DAPI::setName($userId, 'New Nickname');

sendMessageToUser(string $userId, string $message): Response|false

Send a direct message (plain text) to a user.

$result = DAPI::sendMessageToUser($userId, 'Hello in your DMs!');

if ($result === false) {
    // handle failure
}

sendEmbedMessageToUser(string $userId, array $payload): Response|false

Send a rich embed (or any valid Discord message payload) to a user via DM.

$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.

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


Contributing

Issues and pull requests are welcome.


License

This project is open-source software licensed under the MIT license.
See the LICENSE file for details.


All versions of discord-api with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
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 reysa/discord-api contains the following files

Loading the files please wait ...