Concepts

Core concepts

The model behind definitions, preferences, contexts, and delivery decisions.

Notification definitions

A definition gives a notification a stable key and describes its supported channels. It can also declare defaults, mandatory behavior, opt-in behavior, labels, categories, and supported contexts.

Explicit versus effective preferences

An explicit preference is the value stored for a user. An effective preference is the result after NotificationCompass applies user values, definition rules, channel defaults, and the package fallback.

The result includes enabled, reason, source, and mandatory, so a settings UI can explain why a channel is enabled or disabled.

Contexts

A NotificationContext identifies a business scope with a type and identifier:

$context = new NotificationContext('organization', 42);

Its storage key is organization:42. Context preferences take precedence over global preferences when the notification supplies a matching context.

Delivery decisions

The NotificationGate uses unknown_notifications to handle notifications that are not registered. The default allow mode returns null and keeps Laravel's normal behavior. deny returns a disabled decision with the unknown_notification reason, while throw raises a LogicException. Registered notifications can be rejected when their channel or context is unavailable, or when their resolved preference is disabled.