An extension for implementing Web Push Notifications on your website in a breeze.
Documentation is at docs/README.md
The preferred way to install this extension is through composer.
php composer.phar require --prefer-dist machour/yii2-web-push-notification
This module use the following tables:
Name | Role |
---|---|
{{%wpn_app}} |
Represents a Web Push application |
{{%wpn_subscription}} |
Represents a Web Push subscriber |
{{%wpn_campaign}} |
Represents a Web Push campaign (ie, a push you've scheduled or sent) |
{{%wpn_report}} |
Links a subscriber to a push (received ? errored ? ..) |
Use the following migration to create them:
./yii migrate --migrationPath=vendor/machour/yii2-web-push-notifications/src/migrations/
Add this module to your \yii\web\Application
config file :
return [
// ...
'modules' => [
'wpn' => [
'class' => 'machour\yii2\wpn\Module',
],
// ...
],
];
Add this module to your \yii\console\Application
config file :
return [
// ...
'bootstrap' => [..., 'wpn'],
// ...
'modules' => [
'wpn' => [
'class' => 'machour\yii2\wpn\Module',
],
// ...
],
]
You can now register a new application using the ./yii wpn/app/create
console command.
Arguments are as follow:
USAGE
yii wpn/app/create <name> <host> <subject> [...options...]
- name (required): string
The application name
- host (required): string
The hostname where the application will be deployed
- subject (required): string
The contact for the application. Needs to be a URL or a mailto: URL.
This provides a point of contact in case the push service needs to contact you