Download the PHP package codewiser/postie without Composer
On this page you can find all versions of the php package codewiser/postie. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codewiser/postie
More information about codewiser/postie
Files in codewiser/postie
Package postie
Short Description Subscription management Laravel package
License MIT
Informations about the package postie
Postie
Postie is a dashboard where users can manage their subscription preferences.
- Installation
- Configuration
- Subscriptions
- Channels
- Groups
- Preview
- Sending Notifications
Every Notification
in application has corresponding audience. It doesn't mean, that everyone from audience will receive a notification, but it is possible. So, Postie allows user to decide what channels he or she wants to be used to deliver notification.
Installation
Install Postie into your project using the Composer package manager:
composer require codewiser/postie
After installing Postie, publish its assets using the postie:install
Artisan command:
php artisan postie:install
Before running migrations you may want to change name of the table, that keeps user subscription preferences. Then see config/postie.php
.
After you configured table name run migrations:
php artisan migrate
Configuration
After installing Postie, its service provider will be located at App\Proviers\PostieServiceProvider
.
First, provide information about every Notification
, that users may manage. Every subscription requires list of available channels and possible audience (as builder).
Second, replace Notification::via()
method with \Codewiser\Postie\Notifications\Traits\Channelization
trait. Notification
will use list of channels defined in associated Subscription
.
Subscription Definition
Subscription
is an object, that helps you describe application notification for Postie to understand.
Initially, it is enough to pass notification class name, query builder with users, who may receive such notification and channels list, supported by notification.
Moreover, you may define notification title and description.
Channel Definition
When you set up Subscription
, you may pass channel as a simple string. But there are a way to define more complex channel representation.
You may use \Codewiser\Postie\Channel
object to describe channel with custom title, icon etc.:
You may define default state of channel. If channel is active, then all users will receive notifications through this channel until they unsubscribe. Vice versa, if channel is passive, all users will not receive notifications via this channel until they subscribe to it.
Default channel state is active.
If you want to disable user ability to manage channel preferences, you may hide channel form user interface, or just force channel state.
Grouping Subscriptions
You may group subscriptions to create side menu for dashboard. Subscriptions inherit channels and audience form a group, if defined.
Previewing Notifications
You may define notification preview. So user can see how notification will be looks like.
Notification preview may be composed with model factories...
Sending Notifications
Using Postie, you may simply send notification without defining notifiables, as Postie already knows subscribers.
If you need to limit notifiables, you may use a callback:
You still may send notifications using Facade
or notify()
method. As Notification
uses Channelization
trait, it will respect user preferences.