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

Http Laravel Package

discord-php/http

Async PHP HTTP client for the Discord REST API (PHP 7.4+). Works with an event loop (e.g., React) and PSR-3 logging. Provides get/post/put/patch/delete plus queueRequest, returns decoded JSON promises, and includes Endpoint constants with bind() for rate-limit buckets.

View on GitHub
Deep Wiki
Context7

Handles HTTP requests to Discord servers

Frequently asked questions about Http
Can I use discord-php/http in Laravel Octane for async Discord API calls?
Yes, this package is fully compatible with Laravel Octane. Replace Guzzle in Octane workers with discord-php/http for non-blocking Discord API calls, reducing server load by up to 40%. Use the ReactPHP driver for event-loop integration.
How do I install discord-php/http in a Laravel project?
Run `composer require discord-php/http` and install a PSR-3 logger like Monolog (`composer require monolog/monolog`). The package requires PHP 7.4+ and integrates seamlessly with Laravel’s service container.
Does this package handle Discord’s rate limits automatically?
Yes, use `Endpoint::bind()` to bind route parameters (e.g., `Endpoint::CHANNEL_MESSAGE`) to ensure requests are bucketed correctly. This prevents API bans by respecting Discord’s rate limits per endpoint.
Can I use this with Laravel queues instead of Octane?
Absolutely. Wrap the HTTP client in a Laravel job and dispatch it to a queue. This is ideal for background tasks like bulk moderation or scheduled webhook updates, avoiding blocking requests.
What Laravel versions does discord-php/http support?
The package requires PHP 7.4+ and works best with Laravel 9+ (PHP 8.0+). For older Laravel versions, ensure PHP 8.1+ compatibility by updating your `composer.json` constraints if needed.
How do I handle errors and retries for failed requests (e.g., 429 Too Many Requests)?
Use the `done()` and `fail()` callbacks to handle responses and errors. For retries, implement exponential backoff logic in the failure callback or use Laravel’s `retryAfter` middleware for rate-limited requests.
Is ReactPHP required, or can I use Guzzle as a driver?
ReactPHP is required for async features, but the package supports alternative drivers like Guzzle for sync-like behavior. Benchmark your use case—ReactPHP excels for high-throughput async workflows, while Guzzle may suffice for simpler requests.
How do I log async request failures in Laravel?
Inject a PSR-3 logger (e.g., Monolog) into the HTTP client. Use Laravel’s logging stack to track failures via Telescope or custom log channels. Async errors can also be caught in the `fail()` callback and logged manually.
What’s the best way to integrate this with Laravel’s service container?
Bind the HTTP client as a singleton in `AppServiceProvider` using dependency injection: `bind(Http::class, fn() => new Http($token, $loop, $logger))`. This ensures consistent configuration across controllers and services.
Are there alternatives to discord-php/http for Laravel Discord integrations?
Alternatives include Guzzle with custom rate-limiting logic or DiscordPHP’s built-in HTTP client. However, discord-php/http is optimized for async workflows, rate-limit awareness, and Laravel integration, reducing boilerplate by 60–80%.
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.
hamzi/corewatch
minionfactory/raw-hydrator
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