helpers-and-infra-keeper
Skill1.1k starsChanged 36 days agoMITView on GitHub
Work with DiscordPHP's infrastructure utilities — CacheWrapper, CacheConfig, BigInt, Multipart, Endpoint::bind URL templates, Collection base class, and domain Exceptions. Use when changing cache behavior, REST endpoint routing, file uploads, big-integer ID math, or adding/modifying exceptions.
Trending
More talk lately.about the whole repository
Who's talking about discord-php/DiscordPHP
- @throwable.bsky.social“📦 team-reflex/discord-php v10.45.21 An unofficial API to interact with the voice and text service Discord. …”Bluesky · Feb 27, 2026 · 1 likes
- crimsonstrife/streamer.live“Bump team-reflex/discord-php from 10.18.24 to 10.18.45”GitHub · Aug 19, 2025 · 1 reactions
- crimsonstrife/streamer.live“Bump team-reflex/discord-php from 10.18.0 to 10.18.5”GitHub · Jul 8, 2025 · 1 reactions
- crimsonstrife/streamer.live“build(deps): bump team-reflex/discord-php from 10.17.0 to 10.17.3”GitHub · Jun 16, 2025 · 1 reactions
- crimsonstrife/streamer.live“build(deps): bump team-reflex/discord-php from 10.13.1 to 10.14.0”GitHub · Jun 9, 2025 · 1 reactions
The biggest 5 of 52 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 52
Talked about on GitHub and Bluesky (52 times).
On GitHub · 50
- Aug 19, 2025Bump team-reflex/discord-php from 10.18.24 to 10.18.45 — crimsonstrife/streamer.live1 reaction · 2 comments
- Jul 8, 2025Bump team-reflex/discord-php from 10.18.0 to 10.18.5 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 16, 2025build(deps): bump team-reflex/discord-php from 10.17.0 to 10.17.3 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 9, 2025build(deps): bump team-reflex/discord-php from 10.13.1 to 10.14.0 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 2, 2025build(deps): bump team-reflex/discord-php from 10.10.12 to 10.11.6 — crimsonstrife/streamer.live1 reaction · 3 comments
45 more on GitHub
- May 26, 2025build(deps): bump team-reflex/discord-php from 10.10.0 to 10.10.6 — crimsonstrife/streamer.live1 reaction · 2 comments
- May 19, 2025build(deps): bump team-reflex/discord-php from 10.7.3 to 10.8.5 — crimsonstrife/streamer.live1 reaction · 2 comments
- May 5, 2025build(deps): bump team-reflex/discord-php from 10.7.1 to 10.7.2 — crimsonstrife/streamer.live1 reaction · 2 comments
- Apr 28, 2025build(deps): bump team-reflex/discord-php from 10.4.7 to 10.7.1 — crimsonstrife/streamer.live1 reaction · 3 comments
- Mar 25, 2025build(deps): bump team-reflex/discord-php from 10.4.3 to 10.4.4 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jul 18, 2024✨ Add support for polls — laracord/framework1 reaction
- May 11, 2024update d.py/d.php polls — advaith1/libs1 reaction · 1 comment
- Nov 11, 2026build(deps): update team-reflex/discord-php requirement from 10.71.* to 10.72.* — smrealms/smr0 reactions
- Nov 2, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.71.* — smrealms/smr0 reactions
- Oct 26, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.69.* — smrealms/smr0 reactions · 1 comment
- Oct 20, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.68.* — smrealms/smr0 reactions · 1 comment
- Oct 19, 2026Bump team-reflex/discord-php from 10.59.0 to 10.67.0 — omnicolor/commlink0 reactions · 1 comment
- Oct 14, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.67.* — smrealms/smr0 reactions · 1 comment
- Oct 13, 2026Bump team-reflex/discord-php from 10.59.0 to 10.66.3 — omnicolor/commlink0 reactions · 1 comment
- Oct 6, 2026Bump team-reflex/discord-php from 10.59.0 to 10.66.1 — omnicolor/commlink0 reactions · 1 comment
- Oct 5, 2026Bump team-reflex/discord-php from 10.59.0 to 10.65.0 — omnicolor/commlink0 reactions · 1 comment
- Oct 1, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.66.* — smrealms/smr0 reactions
- Oct 1, 2026Bump team-reflex/discord-php from 10.57.0 to 10.59.0 — omnicolor/commlink0 reactions
- Sep 30, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.62.* — smrealms/smr0 reactions · 1 comment
- Sep 29, 2026Bump team-reflex/discord-php from 10.57.0 to 10.58.0 — omnicolor/commlink0 reactions · 1 comment
- Sep 28, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.59.* — smrealms/smr0 reactions · 1 comment
- Sep 25, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.58.* — smrealms/smr0 reactions · 1 comment
- Sep 25, 2026Bump team-reflex/discord-php from 10.56.18 to 10.57.0 — omnicolor/commlink0 reactions
- Sep 23, 2026Bump team-reflex/discord-php from 10.56.17 to 10.56.18 — omnicolor/commlink0 reactions
- Sep 21, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.57.* — smrealms/smr0 reactions · 1 comment
- Sep 14, 2026Bump team-reflex/discord-php from 10.56.15 to 10.56.17 — omnicolor/commlink0 reactions
- Sep 7, 2026Bump team-reflex/discord-php from 10.56.10 to 10.56.15 — omnicolor/commlink0 reactions
- Sep 7, 2026build: Bump team-reflex/discord-php from 10.48.14 to 10.56.15 — VATSIM-UK/core0 reactions
- Sep 4, 2026Bump team-reflex/discord-php from 10.56.10 to 10.56.13 — omnicolor/commlink0 reactions · 1 comment
- Sep 2, 2026Bump team-reflex/discord-php from 10.56.8 to 10.56.10 — omnicolor/commlink0 reactions
- Sep 1, 2026Bump team-reflex/discord-php from 10.56.8 to 10.56.9 — omnicolor/commlink0 reactions · 1 comment
- Aug 26, 2026Bump team-reflex/discord-php from 10.55.1 to 10.56.5 — omnicolor/commlink0 reactions
- Aug 25, 2026Bump team-reflex/discord-php from 10.55.1 to 10.56.3 — omnicolor/commlink0 reactions · 1 comment
- Apr 20, 2026Bump team-reflex/discord-php from 10.47.12 to 10.48.1 — crimsonstrife/streamer.live0 reactions · 1 comment
- Feb 10, 2026Bump team-reflex/discord-php from 10.45.15 to 10.45.16 — crimsonstrife/streamer.live0 reactions · 3 comments
- Nov 4, 2025Add Discord Announcement Bot System — k33bz/lastwar-server15860 reactions · 4 comments
- Oct 20, 2025Tag "@property" has error when both ? and null types are included — phpDocumentor/phpDocumentor0 reactions · 1 comment
- Nov 15, 2024Update dependency team-reflex/discord-php to v10 — System3-2/discord-bot0 reactions
- Feb 11, 2024Thread gets terminated when using a slash command with options. — DiscordBot-PMMP/DiscordBot0 reactions · 3 comments
- Jan 14, 2024Update dependency team-reflex/discord-php to v7.3.5 — Karhal/discord-gpt0 reactions
- Jan 14, 2024Update dependency team-reflex/discord-php to v7.3.5 — System3-2/discord-bot0 reactions
- Jan 31, 2023Invalid Activity URL — DiscordBot-PMMP/DiscordBot0 reactions · 3 comments
- Dec 20, 2022Another message type not supported when delete the message — DiscordBot-PMMP/DiscordBot0 reactions · 6 comments
- Aug 19, 2022[Egg Request]: DiscordPHP — pelican-eggs/eggs0 reactions · 1 comment
- Apr 17, 2022Intents help — DiscordBot-PMMP/DiscordBot0 reactions · 4 comments
On Bluesky · 2
- Feb 27, 2026📦 team-reflex/discord-php v10.45.21 An unofficial API to interact with the voice and text service Discord. 🔗… — @throwable.bsky.social1 likes and repost
- Aug 10, 2026📦 team-reflex/discord-php v10.55.0 An unofficial API to interact with the voice and text service Discord. 🔗… — @throwable.bsky.social0 likes and reposts · 1 reply
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- async-test-and-doc-syncSkill
- builder-payload-smithSkill
- gateway-cache-sync-keeperSkill
- interaction-flow-keeperSkill
- legacy-command-client-keeperSkill
- part-model-maintainerSkill
- repository-cache-keeperSkill
- runtime-bootstrap-keeperSkill
- type-map-keeperSkill
- voice-subsystem-keeperSkill
- discord-php-bot-securitySkill
- discord-php-extensionSkill
- discord-php-interactionsSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use this skill when work touches src/Discord/Helpers/*, src/Discord/Exceptions/*, Endpoint::bind() patterns, or the external Collection / …
- Very specific: line 40
If a feature needs configurable cache behavior (TTL, compression, sweep interval), add it as a property on CacheConfig.
- Distinctive: line 44
When a REST write succeeds, the cache write must happen in the same promise chain — not after a refetch.
- Very specific: line 48
All REST endpoints are defined as Endpoint constants in the external discord-php/http package:
- Very specific: line 62
Rule: never build URL strings by hand.
- Very specific: line 72
After implementing an operation, or deciding not to, run composer openapi:update and commit the baseline.
- Very specific: line 78
All repositories extend Collection from discord-php-helpers/collection.
- Very specific: line 98
Rule: use BigInt for any permission flag arithmetic or snowflake comparison that could run on 32-bit PHP.
- Very specific: line 123
When adding a new typed exception: extend \Exception or the nearest domain parent, keep the name *Exception, and put it in …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: helpers-and-infra-keeper
Use this skill when work touches src/Discord/Helpers/*, src/Discord/Exceptions/*, Endpoint::bind() patterns, or the external Collection / discord-php/http packages.
These are cross-cutting infrastructure utilities. They have no domain logic, but nearly every other layer depends on them.
Read in this order
src/Discord/Helpers/CacheWrapper.php— PSR-16 + React cache bridgesrc/Discord/Helpers/CacheConfig.php— cache options (compression, sweep, TTL)src/Discord/Helpers/LegacyCacheWrapper.php— fallback for older cache implementationssrc/Discord/Helpers/BigInt.php— 32-bit PHP GMP polyfill for snowflake IDs and permission bitfieldssrc/Discord/Helpers/Multipart.php— multipart/form-data builder for file uploadssrc/Discord/Repository/AbstractRepository.php— how repositories consumeCacheWrapperand$endpointssrc/Discord/Discord.php—options['cache']wiring toCacheWrapper/CacheConfig
Cache infrastructure
Three-class hierarchy
| Class | Role |
CacheConfig | Value object holding cache options passed in Discord::__construct() options['cache'] |
CacheWrapper | Main wrapper: bridges React's async cache (PSR-16 + react/cache) to repository storage. Handles compression if configured. |
LegacyCacheWrapper | Default when no external cache is configured. Wraps an in-memory store. Used by default. |
Rule: repositories do not interact with cache stores directly. They always go through CacheWrapper. Do not bypass it.
When to use CacheConfig
If a feature needs configurable cache behavior (TTL, compression, sweep interval), add it as a property on CacheConfig. Do not scatter cache tuning across individual repositories.
Cache coherence rule
When a REST write succeeds, the cache write must happen in the same promise chain — not after a refetch. This is enforced by convention, not framework. Break the chain and you get stale cache.
Endpoint::bind() — URL template pattern
All REST endpoints are defined as Endpoint constants in the external discord-php/http package:
use Discord\Http\Endpoint;
protected $endpoints = [
'get' => Endpoint::CHANNEL,
'update' => Endpoint::CHANNEL,
'delete' => Endpoint::CHANNEL,
];Routes with parameters use :param placeholders. Binding happens via Endpoint::bind($endpoint, $params) where $params is a key-value map matching the placeholders.
Rule: never build URL strings by hand. Always use Endpoint::bind() or assign a named Endpoint constant. Raw string concatenation bypasses rate-limit bucket identification.
Finding endpoint constants
Browse vendor/discord-php/http/src/Endpoint.php for available constants. If a Discord API endpoint is missing, add it to the external package — do not define it inline in DiscordPHP source.
Checking against Discord's OpenAPI description
composer openapi (scripts/openapi-check.php) compares the library with the live preview of Discord's OpenAPI description. It lists the operations DiscordPHP never sends a request for, and routes with no Endpoint constant. It also lists what Discord has changed since the commit recorded in scripts/openapi-baseline.json: endpoints added or removed, parameters and responses, schema properties and enum values. It reads the library's source to see which request each constant is sent with. It recognises a repository's $endpoints table (all/get send GET, create POST, update PATCH, delete DELETE, and other keys whatever method sends $this->endpoints['key']), a direct call like ->post(Endpoint::bind(Endpoint::X, …)), or a variable assigned the endpoint and sent later in the same method. Keep new request code in one of those shapes, or the check will report the operation as unsent.
After implementing an operation, or deciding not to, run composer openapi:update and commit the baseline. Record the reason for every gap that remains in its unimplemented map. A daily workflow (.github/workflows/openapi.yml) runs the same check and opens an issue labelled openapi when it finds something new.
The check also reads Discord's stable description (specs/openapi.json) at the same commit. Operations, parameters, properties and enum values that only the preview has are marked [preview only]; the issue then carries a caution and the openapi-preview label. Discord may change or remove them at any time. Anything implemented from them gets @since X.Y.Z OpenAPI Preview in its docblock and a sentence saying it is only in Discord's OpenAPI preview and may change or be removed at any time, so users do not rely on it. composer openapi -- --all lists everything only in the preview. When the check reports something as now in the stable edition too, remove its preview flag.
Collection base class
All repositories extend Collection from discord-php-helpers/collection. Key behaviors inherited:
- discriminator-keyed storage (
$discrim— defaults to'id') - typed item enforcement (
$class) get($key),has($key),first(),find(callable),filter(callable)- JSON serialization
AbstractRepository adds REST/cache behavior on top. Do not re-implement collection operations in repositories — use the inherited helpers.
BigInt
BigInt provides GMP-based arithmetic for environments where PHP is compiled as 32-bit, where Discord snowflake IDs and 64-bit permission bitfields overflow native integers.
Usage pattern:
use Discord\Helpers\BigInt;
$perms = BigInt::bitAnd($memberPerms, $requiredPerm);Rule: use BigInt for any permission flag arithmetic or snowflake comparison that could run on 32-bit PHP. Do not assume PHP_INT_SIZE === 8.
Multipart
Multipart builds multipart/form-data request bodies for file attachment uploads. It is used by MessageBuilder and similar builders when attachments are present.
It has no cache or domain logic — treat it as a serialization helper.
Exception hierarchy
src/Discord/Exceptions/ contains domain-specific exceptions. Do not use generic \RuntimeException or \InvalidArgumentException when a typed exception already exists:
| Exception | When to throw |
IntentException | Invalid or missing gateway intents at startup |
PartRequestFailedException | A part fetch or REST operation failed |
InvalidOverwriteException | A permission overwrite is malformed |
AttachmentSizeException | Attachment exceeds size limit |
FileNotFoundException | File path not found for upload |
BufferTimedOutException | Audio buffer read timed out |
LibSodiumNotFoundException | ext-sodium not available (voice) |
OpusNotFoundException | Opus codec binary not available |
FFmpegNotFoundException | FFmpeg binary not found |
DCANotFoundException | DCA tool not found |
When adding a new typed exception: extend \Exception or the nearest domain parent, keep the name *Exception, and put it in src/Discord/Exceptions/.
Companion surfaces
| Touching | Also inspect |
CacheWrapper or CacheConfig | Discord.php options['cache'] wiring, AbstractRepository cache usage, LegacyCacheWrapper fallback |
Endpoint constants | $endpoints arrays in all affected repositories, rate-limit bucket behavior |
BigInt | Permission parts (Permission, RolePermission, ChannelPermission), snowflake comparison sites |
Multipart | MessageBuilder attachment handling, HTTP client request formation |
| An exception class | Callers that catch the specific type, docs/guide if it's user-facing |
Design tripwires
- Building REST URL strings by hand instead of using
Endpoint::bind() - Writing to a cache store directly inside a repository, bypassing
CacheWrapper - Re-implementing collection iteration helpers that
Collectionalready provides - Using
PHP_INT_SIZE === 8as a safe assumption for permission arithmetic — useBigInt - Throwing
\RuntimeExceptionwhen a typed domain exception already exists - Adding domain logic (Discord resource rules) to any class in
Helpers/orExceptions/ - Putting new audio stream or voice crypto helpers in
Helpers/— those belong inVoice/*or the external voice package
Reference files
src/Discord/Helpers/CacheWrapper.php— main cache bridgesrc/Discord/Helpers/CacheConfig.php— cache options value objectsrc/Discord/Helpers/LegacyCacheWrapper.php— default in-memory cachesrc/Discord/Helpers/BigInt.php— 32-bit PHP GMP polyfillsrc/Discord/Helpers/Multipart.php— file upload form buildersrc/Discord/Repository/AbstractRepository.php— how CacheWrapper and Endpoint are consumedsrc/Discord/Exceptions/IntentException.php— representative typed exceptionsrc/Discord/Exceptions/PartRequestFailedException.php— REST failure exceptionvendor/discord-php/http/src/Endpoint.php— all REST endpoint constants
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

