Download the PHP package thesetj/laravel-notification-foundation without Composer

On this page you can find all versions of the php package thesetj/laravel-notification-foundation. 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-notification-foundation

laravel-notification-foundation

A foundation package for building Laravel notifications. Instead of writing toDatabase(), toFcm(), and toSms() from scratch in every notification, you populate a shared data bag using fluent setters in the constructor — the package delivers it to each active channel automatically.

Channels are registered globally in a published service provider (similar to middleware in bootstrap/app.php) and can be toggled on or off per notification instance.

Base class

Extend QueuedBaseNotification for notifications that should be queued (the common case). Extend BaseNotification directly when you need synchronous delivery — it has no ShouldQueue or Queueable.

Installation

Publish the service provider stub:

Register it in bootstrap/providers.php (Laravel 11+) or config/app.php:

The zero-override pattern

The default toDatabase(), toFcm(), and toSms() implementations read directly from what you set via the fluent API. For most notifications, no payload methods need to be written at all — the entire notification is just a constructor:

setSharedData() is merged into every active channel's payload automatically. Individual channels can add their own data on top, or rely on shared data alone. No toDatabase(), toFcm(), or toSms() methods needed.

Extending the default FCM payload

The default toFcm() builds a ready-to-send FcmMessage. To add extra fields on top of it, call parent::toFcm() and chain mergeData() — the same pattern as extending a database channel's buildPayload():

setData() and mergeData() coerce FCM data values to strings automatically (FCM requires this). Booleans become '1'/'0', numbers become their string representation, arrays and objects are JSON-encoded. String values are passed through unchanged.

Overriding a payload method

Override the full method when the default merge logic does not apply. The data bag and shared data are still available:

Per-instance channel toggling

Every registered channel — built-in or custom — automatically gets fluent toggle methods:

The default active state per channel is set in the service provider (see below).

Channel registration

Edit the published App\Providers\NotificationFoundationServiceProvider. Comment out or remove what you don't need, and add your own channels:

The third argument is the default state (true = active, false = inactive).

Channel names are normalized to lowercase, so 'myChannel' and 'mychannel' are equivalent. The convention is to use lowercase names, as shown above.

Driver binding

FcmChannel and SmsChannel delegate delivery to driver contracts. Bind your implementations in a service provider:

FCM driver

Implement FcmDriverContract. The contract's send() method receives either a single token string or an array of tokens, so it can serve as a gateway to whatever internal structure your provider requires:

SMS driver

Implement SmsDriverContract. The send() method can likewise act as a gateway — if your SMS provider supports bulk sending, add a private sendMany() and dispatch from send() based on whether $message->getTo() is a single number or a list:

FCM routing

Add routeNotificationForFcm() to your notifiable model:

SMS routing

Add routeNotificationForSms() to your notifiable model, or set the recipient directly on the message:

To set a sender ID or from-number, call from() on the message. The driver receives it via getFrom():

Testing

Call BaseNotification::flushChannelRegistry() in setUp and tearDown to reset the global channel registry between tests:


All versions of laravel-notification-foundation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/bus Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/notifications Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
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 thesetj/laravel-notification-foundation contains the following files

Loading the files please wait ...