Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Discord Php

Discord Php Laravel Package

team-reflex/discord-php

DiscordPHP is a PHP wrapper for Discord’s REST, gateway, and voice APIs. Build Discord bots that run in CLI with ReactPHP-style async handling. Includes limited docs/class reference and community integrations like Laracord for Laravel.

View on GitHub
Deep Wiki
Context7

An API to interact with the popular messaging app Discord

Frequently asked questions about Discord Php
Can I use DiscordPHP directly in a Laravel HTTP route or controller?
No, DiscordPHP is designed for CLI processes and cannot run inside Laravel’s HTTP request/response cycle. You’ll need to run it as a separate process (e.g., via Laravel Queues, Supervisor, or a Docker container) and communicate between Laravel and DiscordPHP using queues, Redis, or REST APIs.
What Laravel versions does the laracord/laracord package support?
Laracord’s compatibility depends on its latest release, but it typically aligns with Laravel 8.x and 9.x. Check the [Laracord GitHub](https://github.com/laracord/laracord) for version-specific requirements. DiscordPHP itself supports PHP 8.0+, which Laravel 8+ also requires.
How do I handle Discord events (e.g., messages) in Laravel using DiscordPHP?
DiscordPHP uses an event-driven model via ReactPHP. With Laracord, you can bind Discord events to Laravel’s service container and dispatch them as Laravel jobs or queue them for async processing. For example, a message event could trigger a `HandleDiscordMessage` job in Laravel’s queue system.
Is DiscordPHP suitable for production bots with high traffic?
Yes, but with caveats. DiscordPHP handles rate limits and WebSocket reconnections robustly, but you’ll need to manage memory (e.g., `ini_set('memory_limit', '-1')`) and isolate the bot process. Use Laravel Queues to throttle API calls and monitor the CLI process with tools like Supervisor or PM2.
Can I integrate DiscordPHP’s voice features into a Laravel app?
Voice support requires the separate `discordphp-voice` package, which adds complexity. It runs independently of Laravel and needs a WebRTC-compatible server. For Laravel integration, you’d typically expose voice endpoints via a microservice (e.g., gRPC) or handle voice logic in the CLI process while syncing state with Laravel via Redis.
How do I share data between Laravel and a DiscordPHP bot running in CLI?
Use a shared data store like Redis or a database. For example, store user preferences in Laravel’s Eloquent and sync them with the bot via Redis pub/sub or a Laravel Queue listener. Avoid Laravel’s request-scoped state (e.g., sessions) as DiscordPHP runs persistently.
What are the alternatives to DiscordPHP for Laravel Discord bots?
For Laravel-native solutions, consider `discord-php/discord-php` (REST-only) or `laravel-discord` packages, which are simpler but lack Gateway/Voice support. For full-featured alternatives, use `jda-php/JDA` (Java-based) or `discord.js` (Node.js) with a Laravel microservice bridge. DiscordPHP is unique for its async, CLI-first approach.
How do I debug issues when DiscordPHP runs as a separate CLI process?
CLI logs won’t appear in Laravel’s log system. Use structured logging (e.g., Monolog with ELK stack) or redirect CLI output to a file. For errors, implement health checks (e.g., ping endpoints) and monitor the process with Supervisor or Docker logs. Laravel’s error handlers won’t catch CLI crashes.
Does DiscordPHP support Laravel’s authentication (e.g., Sanctum, Passport) for Discord commands?
Not natively. DiscordPHP operates outside Laravel’s auth system. To integrate, sync Discord user IDs with Laravel’s users table (e.g., via Redis) and validate commands using Laravel’s auth logic in a separate service layer. Avoid mixing Laravel’s session-based auth with DiscordPHP’s persistent state.
Can I deploy a DiscordPHP bot on shared hosting like Heroku or cPanel?
Shared hosting typically doesn’t support long-running CLI processes. Heroku requires a worker dyno for background jobs, while cPanel lacks CLI execution. Use a VPS (e.g., DigitalOcean, AWS EC2) with Supervisor or Docker to manage the DiscordPHP process. For Heroku, consider a separate service or a microservice architecture.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai