# `PhoenixKit.Users.Referrals`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.213/lib/phoenix_kit/users/referrals.ex#L1)

Core-side runtime bridge to the optional `phoenix_kit_referrals` package.

The referral-codes feature lives in the standalone `phoenix_kit_referrals`
module. Core has **no compile-time dependency** on it — this facade resolves
the installed module at runtime by its `PhoenixKit.Module` key (`"referrals"`)
via `PhoenixKit.ModuleRegistry` and dispatches through it.

When the package isn't installed (or doesn't export a given function) every
call degrades safely: the system reads as disabled, lookups return `nil`, and
`use_code/2` is a no-op. That lets the registration / OAuth / magic-link flows
treat referrals as optional — with the module absent, the referral field never
appears and nothing is recorded.

The function surface here mirrors exactly what the signup flows call, so those
call sites only had to swap their alias to this module.

# `enabled?`

Whether a referrals module is installed and enabled.

# `expired?`

Whether the given code is expired (`false` when the module is absent).

# `get_code_by_string`

Look up a referral code struct by its string, or `nil`.

# `get_config`

Referral-codes configuration map. Disabled defaults when the module is absent.

# `usage_limit_reached?`

Whether the given code hit its usage limit (`false` when absent).

# `use_code`

Record a use of `code_string` by `user_uuid`.

No-op returning `{:error, :referrals_not_installed}` when the module is absent.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
