Download the PHP package deegitalbe/laravel-trustup-io-notifications without Composer

On this page you can find all versions of the php package deegitalbe/laravel-trustup-io-notifications. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-trustup-io-notifications

Trustup IO Notifications (Laravel client)

Drop-in Laravel client for the Trustup IO Notifications service. It lets a source application send notifications through Laravel's native notification system and receive delivery feedback (delivered, bounced, opened, clicked, ...), all over Kafka.

The notification payloads and channel definitions live in the contracts package. See its README for how to define a NotificationData class, override channel rendering, and add a new notification type. This README covers wiring the client into an app and the send / receive flows.


1. Install

The service provider is auto-discovered. It registers the config file and the two consume commands.

2. Configure

Publish the config if you want to edit defaults (optional; env vars are enough for most apps):

Set the source and the Kafka broker. Everything else has working defaults.

Config keys (config/trustup-io-notifications.php):

Key Env Default Purpose
topics.request TRUSTUP_IO_NOTIFICATIONS_TOPIC_REQUEST notifications.request Topic this app publishes send requests to.
topics.status TRUSTUP_IO_NOTIFICATIONS_TOPIC_STATUS notifications.status Topic this app consumes delivery statuses from.
topics.engagement TRUSTUP_IO_NOTIFICATIONS_TOPIC_ENGAGEMENT notifications.engagement Topic this app consumes engagement events from.
topics.dlq TRUSTUP_IO_NOTIFICATIONS_TOPIC_DLQ notifications.dlq Dead-letter topic for both consumers.
source TRUSTUP_IO_NOTIFICATIONS_SOURCE null Default Source when a recipient has none. If null and no source on the recipient → MissingSourceException.

3. Send a notification (bare minimum)

Three pieces: a notification class, a notifiable that knows its recipient, and a notify() call.

The notification

The notification receives your own domain models and derives the NotificationData from them inside toTrustupIoNotificationsData(). You do not pass the data object in from the outside. Both toTrustupIoNotificationsData() and restrictTrustupIoNotificationsChannels() receive the notifiable being notified, so the payload and the channel restriction can depend on the recipient.

The notifiable

Add Laravel's Notifiable (for notify()), implement the interface, and use the routing trait:

Notifiable is required (it provides notify()); the package does not include it for you. RoutesTrustupIoNotifications wires Laravel's routing convention to your toTrustupIoNotificationsRecipient().

The recipient omits the source: the client fills it from TRUSTUP_IO_NOTIFICATIONS_SOURCE at publish time. Pass it explicitly (Recipient::identified((string) $this->id, Source::Tools)) only if this app sends for more than one source.

Send it

That publishes the request to Kafka. The notifications service picks it up, resolves the recipient's coordinates, and delivers on each supported channel.

4. Receive delivery feedback

The service publishes back onto the status and engagement topics. The client turns those into two Laravel events you listen to.

Run the consumers + a queue worker

The consume commands are long-running Kafka consumers. They only enqueue jobs; the events fire from inside those queued jobs. So you need the consumers and a queue worker running:

Without a queue worker, statuses and engagements are consumed but the events never dispatch.

Listen to the events

The package defines no listeners of its own by design: it emits the events, your app decides what to do (update a local model, alert on bounce, track engagement, ...). Register as many listeners as you want, on either event. Dispatching with zero listeners is a no-op, not an error.

StatusPayload and EngagementPayload shapes are documented in the contracts README.

5. What must be running

Process Role Where
queue:work / Horizon Runs the queued jobs that both send and receive rely on source app
trustup-io-notifications:consume-statuses Consumes delivery statuses → TrustupIoNotificationStatusReceived source app
trustup-io-notifications:consume-engagements Consumes engagements → TrustupIoNotificationEngagementReceived source app
Kafka broker Transport for all topics shared infra
The notifications service Consumes request, delivers, publishes status / engagement separate service

Sending only needs a reachable Kafka broker. Receiving feedback needs the two consumers and a queue worker.


Customization

Restrict channels per notification

By default a notification goes out on every channel its data class supports. Override to narrow it:

null = all supported channels. [] is invalid and rejected (InvalidEnvelopeException).

Anonymous recipients (no model)

When there is no notifiable model, route on the fly with a Recipient::anonymous(...):

The routing key is the literal string trustup-io-notifications.

Customize the payload / channels / rendering

The notification's content (which template, which variables, SMS/push wording, translations) is controlled by the NotificationData class and its Renders* traits, all in the contracts package. See that README's "Capability interfaces and their default rendering" section for the overridable methods (emailTemplate, emailVariables, emailTemplateLocaleGranularity, smsBody, pushTitle, ...).

Default source vs explicit source

Recipient::identified($id, Source::Tools) sets the source explicitly. Built without a source (Recipient::identified($id) or any anonymous recipient), the client fills it from config('trustup-io-notifications.source') at publish time. Set TRUSTUP_IO_NOTIFICATIONS_SOURCE so this always resolves.

Errors

Exception When
MissingTrustupIoNotificationContractException The notification does not implement SendsTrustupIoNotification.
UnresolvableRecipientException The notifiable exposes no recipient (missing method / on-demand route not a Recipient).
MissingSourceException Recipient has no source and no config('...source') default.
MissingTopicConfigException A required topic config key is null at publish time.
InvalidRecipientException / InvalidEnvelopeException Invalid recipient coordinates or an empty channel list.

All versions of laravel-trustup-io-notifications with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^12.0
spatie/laravel-package-tools Version ^1.16
mateusjunges/laravel-kafka Version ^2.11
deegitalbe/laravel-trustup-io-notifications-contracts Version ^3.9.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package deegitalbe/laravel-trustup-io-notifications contains the following files

Loading the files please wait ...