Download the PHP package pxlrbt/laravel-notification-preview without Composer

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

Laravel Notification Preview

Browse, preview and test-send every notification and mailable in your Laravel app.

Features

Installation

The routes register themselves and are always disabled in the production environment. Open the preview at /dev/notifications.

Configuration

paths takes directories only — namespaces come from Composer's PSR-4 map. Point it at a whole domain directory if you like; abstract classes and anything that is neither a notification nor a mailable are skipped.

Both mailable styles work: envelope()/content() and the older build().

Other channels

Mail is the only channel rendered as a message. Every other one is shown as the JSON payload it would hand its provider. Opt them in:

Each notification gains one tab per channel its via() declares. Names match driver strings and channel classes alike, so smsapi also covers an SmsapiChannel::class.

Authorization

By default there is no check: outside production, anybody who can reach the URL can open the preview. Narrow that down with an auth closure:

Anyone the closure turns down gets a 403.

Hiding classes

exclude takes fully qualified class names and namespaces. A namespace hides everything below it:

Argument resolution

For each constructor parameter the preview tries these sources, in order, and takes the first one that answers:

# Source Applies to
1 A value edited in the UI Scalars, enums and dates
2 A registered resolver The parameter reference first, then its type
3 The parameter's default value Anything with a default
4 A value derived from the type See below
5 A faked scalar derived from the parameter name $email, $url, $name and $*Id get plausible values, everything else gets 'Sample text'

Step 4 derives from the type itself:

Type Value
Enum Its first case
Date now()
Model Model::factory()->make(), falling back to Model::query()->first()
Collection Empty
Anything else Resolved from the container

Supplying your own data

Resolvers

Register these in a service provider, keyed by type:

Untyped parameters cannot be matched by type, so key them by parameter instead. A key registered against a parent class covers every subclass:

The notifiable that notifications are rendered against works the same way:

Per-notification configuration

for() returns one object holding everything the viewer shows about a single notification — its label, its group and its variants:

Variants are for notifications that need more than constructor arguments — setters, a specific state, a particular payload. A variant returns the finished notification and skips argument resolution entirely.

Labels are derived when you do not set them: from the class name for the notification, from its key for a variant, so by-customer shows as "By Customer". label() and group() both take a string or a closure, and a closure defers a translation until the preview is rendered rather than resolving it while your service provider boots:

Variants can pin their own notifiable:

Configuration on the notification itself

To keep the preview data next to the notification, add a static preview() method. Same object, no interface to implement:

Both sources merge, and anything registered through for() wins — per property, and per variant key. A class that declares a label and a service provider that sets only a group end up with both.

Registering and excluding classes

Testing


All versions of laravel-notification-preview with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
composer-runtime-api Version ^2.0
illuminate/contracts Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.16
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 pxlrbt/laravel-notification-preview contains the following files

Loading the files please wait ...