PHPackages                             ucarsolutions/recipient-resolver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ucarsolutions/recipient-resolver

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ucarsolutions/recipient-resolver
================================

simple leightweight key and environment based recipient resolver service

0.0.6(6mo ago)0483↓33.3%MITPHP

Since Nov 8Pushed 6mo agoCompare

[ Source](https://github.com/Ucar-Solutions/recipient-resolver)[ Packagist](https://packagist.org/packages/ucarsolutions/recipient-resolver)[ RSS](/packages/ucarsolutions-recipient-resolver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

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?
----

[](#why)

- Centralize who gets which emails (alerts, ops, marketing, …)
- Keep config in version control (YAML)
- Resolve lists reliably in code (`alerts` → `Recipient(to: ["alerts@example.com"])`)

Features
--------

[](#features)

- ✅ Tiny API: `all()` and `resolve($list)`
- ✅ YAML provider included
- ✅ `Recipient` value object (TO/CC/BCC) + `NullRecipient` fallback
- ✅ JSON-serializable recipients
- ✅ Framework-agnostic, strict types
- 🔌 Extensible via `RecipientProviderInterface`

Install
-------

[](#install)

```
composer require ucarsolutions/recipient-resolver
```

Usage
-----

[](#usage)

### 1) YAML config (with TO/CC/BCC)

[](#1-yaml-config-with-toccbcc)

```
# recipients.yaml
alerts:
  receiver:
    - alerts@example.com
  cc:
    - cc.alerts@example.com
  bcc: []

billing:
  receiver:
    - billing@example.com
    - finance@example.com
  cc: []
  bcc:
    - billing.bcc@example.com

marketing-de:
  receiver:
    - de.marketing@example.com
```

> **Schema:** Each top-level key is a *list name*. Under it, use arrays `receiver`, `cc`, and `bcc`. Missing keys are treated as empty lists. Invalid emails are skipped.

### 2) PHP

[](#2-php)

```
