Download the PHP package tobento/app-notification without Composer
On this page you can find all versions of the php package tobento/app-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tobento/app-notification
More information about tobento/app-notification
Files in tobento/app-notification
Package app-notification
Short Description The app notification enables custom notifications, newsletter management and delivery, click and event tracking, and detailed reporting.
License MIT
Homepage https://www.tobento.ch
Informations about the package app-notification
App Notification
The app notification provides the following features:
- app - notifier
- newsletter subscribers
- tracking clicks and events
- reports
Table of Contents
- Getting Started
- Requirements
- Documentation
- App
- Notification Boot
- Notification Config
- Features
- Notifications Feature
- Preview Notification
- Send Notification For Review
- Reports
- Custom Notifications Feature
- Create Custom Notification
- Register Custom Notification
- Manage Custom Notification
- Replace Custom Notification
- Users Notification Feature
- Register User Notification
- Manage User Notification
- Sending User Notifications
- Newsletter Feature
- Register Newsletter Notification
- Manage Newsletter Notification
- Sending Newsletters
- Newsletter Subscribers Feature
- Manage Newsletter Subscribers
- Subscribe And Unsubscribe From Newsletter
- Subscribe Newsletter Feature
- Unsubscribe Newsletter Feature
- Sent Notifications Feature
- Tracking Feature
- Links Tracking
- Events Tracking
- Notifications Feature
- Channels
- Mail Channel
- SMS Channel
- Storage Channel
- Chat Channel
- Push Channel
- Placeholders
- Placeholder
- Greeting Placeholder
- Console
- Notifications Send Command
- Purge Tracking Tokens Command
- Custom Loggers
- Learn More
- Using Multiple Apps
- Configure Language For Notifications
- Credits
Getting Started
Add the latest version of the app notification project running this command.
Requirements
- PHP 8.4 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Notification Boot
The notification boot does the following:
- installs and loads notification config
- implements notification interfaces
- boots notification config
You may install the App Backend and boot the notification in the backend app.
Notification Config
The configuration for the notification is located in the file at the default App Skeleton config location where you can configure features and more.
Features
Notifications Feature
The notifications feature provides a page where users can create, edit and delete any notification types registered such as custom notifications or any other custom notification types created.
Config
In the config file you can configure this feature:
ACL Permissions
- User can access notifications
- User can create notifications
- User can edit notifications
- User can delete notifications
- User can send notifications
If using the App Backend, you can assign the permissions in the roles or users page.
Preview Notification
A preview link is available on the index page and edit page of the notifications if supported by the notification type.
To support previewing, you will use the following two methods on any notification type you want to support it.
Example from the :
You may check out the file too.
Send Notification For Review
On the notifications index page, each notification may have a link to send the notification for reviewing if supported by the notification type.
Sending notifications is supported:
- when a Preview Notification which will be used
- when any other notification the default notification will be used.
Reports
On the notifications index page, each notification may have a link to view reports about sent notifications if supported by the notification type. Reports may differ depending on its notification type. For instance, newsletters notifications, will display the total number of notifications sent, the number of recipients who clicked links if tracking enabled and more.
To support reports, the notification type must implement the and have configured cards using the method.
Example from the :
For further details, please refer to the source file.
You may visit the App Card link to find out more about cards.
Available Cards
- , displays the most clicked links
- , displays the most tracked events
- , displays the recipients click count by channels
Adding Custom Cards Using The ReportCards::class
You can add custom cards onto the class which will be displayed together with the cards defined in the method on the notification types. Use the app method to add cards on demand only:
Adding Or Modifying Cards For Specific Notification Types
You can modify or add cards by simply extending the notification type:
Do not forget to register the customized notification type in the notification config file:
Custom Notifications Feature
You may create custom notifications for replacing notifications send by the App - Notifier.
Create Custom Notification
Lets create a custom notification type for the App User Web - Forgot Password Notification by extending the :
Check out the Placeholders to learn more about it.
Register Custom Notification
config file:
Manage Custom Notification
Custom notifications can be managed by simply enabling the Mail Editor - App Block is used to create the mail messages with, which you may configure to fit your requirements.
Replace Custom Notification
Add the feature to replace notifications with your custom notifications in the app(s) you support. Only notifications with the status will be replaced.
Config
In the config file you can configure this feature:
You may consider using the App Backend to manage custom notifications.
In addition, you may check out the Apps bundle if you want to support multiple apps.
Users Notification Feature
Register User Notification
Register the users notification type so as to config file:
Manage User Notification
User notifications can be easily managed by enabling the Notifications Feature.
Sending User Notifications
You can deliver user notifications created from the web interface by using the Notifications Send Command. There are two main approaches:
Warning Use caution with the option when sending notifications immediately. To avoid timeouts, a maximum of 20 is recommended. When queueing notifications, the interval can be set much higher, with a maximum of 20000 recommended.
Option 1: Using App Schedule
Install the App Schedule bundle and configure a command task:
Option 2: Using App Task
Install the App Task bundle and register the task in the task config file. This allows users to schedule the task directly from the web interface:
Alternatively, you can use the Command Task Registry:
Newsletter Feature
Register Newsletter Notification
Register the newsletter notification type so as to config file:
Manage Newsletter Notification
Newsletter notifications can be managed by simply enabling the Notifications Feature.
Sending Newsletters
You can deliver newsletters created from the web interface by using the Notifications Send Command. There are two main approaches:
Warning Use caution with the option when sending notifications immediately. To avoid timeouts, a maximum of 20 is recommended. When queueing notifications, the interval can be set much higher, with a maximum of 20000 recommended.
Option 1: Using App Schedule
Install the App Schedule bundle and configure a command task:
Option 2: Using App Task
Install the App Task bundle and register the task in the task config file. This allows users to schedule the task directly from the web interface:
Alternatively, you can use the Command Task Registry:
Newsletter Subscribers Feature
The newsletter subscribers feature provides a page where users can create, edit and delete newsletter subscribers to send newsletters using the Newsletter Feature.
Config
In the config file you can configure this feature:
ACL Permissions
- User can access newsletter subscribers
- User can create newsletter subscribers
- User can edit newsletter subscribers
- User can delete newsletter subscribers
If using the App Backend, you can assign the permissions in the roles or users page.
Manage Newsletter Subscribers
Newsletter Subscribers can be managed by simply enabling this feature and using the web interface.
Subscribe And Unsubscribe From Newsletter
Using The Subscriber Repository
You may check out the App User and Service User for more information.
Using User Web
If using the App - User Web bundle, you can register the event listener which will subscribe and unsubscribe users from the newsletter after registration and profile updates depending whether the users clicked the newsletter checkbox.
In the config/event.php file add the following listener:
Subscribe Newsletter Feature
The subscribe newsletter feature provides a simple subscribe to newsletter functionality.
Config
In the config file you can configure this feature:
ACL Permissions
- User can subscribe to newsletter
If using the App Backend, you can assign the permissions in the roles or users page.
Topics
You may configure topics the user can select. In the newsletter type web interface you can specify which topics the newsletter covers and should only be sent to those subscribers who have selected the topics.
In the config file you can configure the topics globally:
Spam Protection
The newsletter subscribe form is protected against spam by default using the App Spam bundle. It uses the spam detector as the defined named detector does not exist. In order to use a custom detector, you will just need to define it on the file:
Rate Limiting
The newsletter subscribe form is rate limitied by default using the App Spam bundle.
You may customize it by overwriting the method:
Available Events
| Event | Description |
|---|---|
| The event will dispatch after a user subscribes to the newsletter. | |
| The event will dispatch after a user subscription failed. |
Unsubscribe Newsletter Feature
The unsubscribe newsletter feature provides a simple unsubscribe from newsletter functionality.
Config
In the config file you can configure this feature:
Use the router to generate unsubscribe links. Make sure you sign the url as the registered route in the feature class is signed too.
You may check out the Signed Routing service for more information.
Additionally, a newsletter notification page.
Warning When using multiple apps, ensure that the is consistently configured in each file, otherwise unsubscribe links may not function properly.
Sent Notifications Feature
This feature is in consideration.
Tracking Feature
The tracking feature will events tracking.
Config
In the config file you can configure this feature:
You may disable tracking using the parameter when registering newsletter notification.
Warning If you do not enable the feature at all, make sure you disable the tracking on all notification types, otherwise tracking links will not be found and result in 404 responses.
Links Tracking
When generating notification content, href links are replaced by a tracking token link, using the implemented and configurable in the querying reports data.
Events Tracking
After a link is clicked, the click ID is stored in the session under the key . You can use this ID to track user activity. You may use the implemented configurable in the config file to store events.
Make sure the uses a storage supporting raw statements as they will be used for querying reports data.
Example
For example, you can record how many orders were generated by a newsletter campaign.
Newsletter notifications have already added the most tracked events card, but you may create a custom report card to display reports about generated orders by a newsletter campaign. Use the app method to register the card on demand only using to add the card:
Check out the reports section to find out more about reports.
Channels
Channels are responsible for rendering the fields required to create channel‑specific messages within the notifications web interface. Based on the configured notification, they generate the corresponding message for the notifier to deliver. In addition, channels manage the notification preview feature.
Configure Channels
Channels can be configure in the notification config file:
Be sure to configure the notifier channels as well.
Mail Channel
The mail channel allows you to create email messages using the Block Mail Editor, which can be customized to meet your requirements. Additionally, it supports uploading email attachments.
Make sure to also configure the corresponding notifier mail channel in the file.
SMS Channel
The SMS channel allows you to create SMS messages.
Make sure to also configure the corresponding notifier sms channel in the file.
Storage Channel
The storage channel enables you to create messages that are displayed on the user notifications page, provided the Notifications Feature from the App User Web is installed.
Make sure to also configure the corresponding notifier storage channel in the file.
Additionally, ensure that the is registered in the same configuration file:
Chat Channel
The chat channel allows you to create chat messages.
Make sure to also configure the corresponding notifier chat channel in the file.
Push Channel
The push channel allows you to create push messages.
Make sure to also configure the corresponding notifier push channel in the file.
Placeholders
Placeholders allow the user to insert placeholders like into their content, which can be replaced with dynamic values when the content is rendered.
Placeholders can be defined in notification type classes. See create custom notification for instance.
Placeholder
This placeholder will replace the placeholder defined by the parameter with the defined.
Greeting Placeholder
This placeholder will replace the placeholder with the greeting from the address.
Console
Notifications Send Command
Use the following command to send any type of notifications:
Available Options
| Option | Description |
|---|---|
| The number of notifications to send or queue. | |
| Define the queue name if you want to queue the notification, otherwise notifcation will be sent immediately. | |
| Send only specific types. | |
| Sends notfication with the status. | |
| The maximum number of times a job should be attempted. | |
| The priority when queueing, highest are first prioritized. | |
| If set notification will be encrypted when queueing. |
Check out the Sending Newsletters section to see possible options how to automate this process.
Purge Tracking Tokens Command
Use the following command to delete expired tracking tokens.
Available Options
| Option | Description |
|---|---|
| The number of days to retain tracking tokens after expiring. |
You may install the App Task bundle and register the following task in the task config file which enables users to schedule the task from a web interface:
Example using the Command Task Registry:
Custom Loggers
You can configure custom loggers in the Logging Config file for the following classes, which make use of the Logger Trait.
Learn More
Using Multiple Apps
When using multiple Apps, you may use the App Backend for managing notifications and subscribers. Make sure that you configure the database using the same connection as in this example.
Next, configure the config for another app (frontend). You may visit the Apps documentation to find out more about creating apps.
Finally, in the database config file, in both apps, configure the database:
Configure Language For Notifications
When using multiple apps you may configure languages for the following services in the backend app.
Credits
- Tobias Strub
- All Contributors
All versions of app-notification with dependencies
tobento/app Version ^2.0
tobento/app-block Version ^2.0
tobento/app-card Version ^2.0
tobento/app-crud Version ^2.0
tobento/app-http Version ^2.0
tobento/app-migration Version ^2.0
tobento/app-notifier Version ^2.0
tobento/app-language Version ^2.0
tobento/app-logging Version ^2.0
tobento/app-translation Version ^2.0
tobento/app-user Version ^2.0
tobento/app-view Version ^2.0
tobento/service-collection Version ^2.0
tobento/service-repository Version ^2.0
tobento/service-repository-storage Version ^2.0
tobento/service-user Version ^2.0