Download the PHP package ucarsolutions/recipient-resolver without Composer
On this page you can find all versions of the php package ucarsolutions/recipient-resolver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ucarsolutions/recipient-resolver
More information about ucarsolutions/recipient-resolver
Files in ucarsolutions/recipient-resolver
Package recipient-resolver
Short Description simple leightweight key and environment based recipient resolver service
License MIT
Informations about the package recipient-resolver
Recipient Resolver
Small, zero-magic library to resolve named recipient lists (e.g. alerts, billing) into a structured Recipient object with To / CC / BCC. Simple YAML config in, objects out. Works great in PHP apps and can be wrapped for CLI/other languages.
Why?
- Centralize who gets which emails (alerts, ops, marketing, …)
- Keep config in version control (YAML)
- Resolve lists reliably in code (
alerts→Recipient(to: ["[email protected]"]))
Features
- ✅ Tiny API:
all()andresolve($list) - ✅ YAML provider included
- ✅
Recipientvalue object (TO/CC/BCC) +NullRecipientfallback - ✅ JSON-serializable recipients
- ✅ Framework-agnostic, strict types
- 🔌 Extensible via
RecipientProviderInterface
Install
Usage
1) YAML config (with TO/CC/BCC)
Schema: Each top-level key is a list name. Under it, use arrays
receiver,cc, andbcc. Missing keys are treated as empty lists. Invalid emails are skipped.
2) PHP
Extensibility
Implement your own source by plugging into the interface:
Then wire it:
Behavior & Guarantees
- Validation: Emails are validated with
filter_var(..., FILTER_VALIDATE_EMAIL). Invalid entries are skipped. - Empties: Missing sections (
receiver/cc/bcc) → treated as empty arrays. - Duplicates: Preserved (provider does not deduplicate).
- Unknown lists:
resolve()returnsNullRecipient(all arrays empty).
Testing
This repo ships with PHPUnit tests using real files/classes (no mocks).
Roadmap help welcome!
- Optional de-duplication per list
- Optional “merge providers” (e.g., base YAML + env override)
- Optional CLI wrapper to print JSON/CSV/lines
Contributing
Issues and PRs are very welcome. Keep it small, readable, and covered by tests.
For new providers, add minimal docs + tests.
License
MIT © Ucar Solutions