Download the PHP package philippoehrlein/kirby-push-notifications without Composer

On this page you can find all versions of the php package philippoehrlein/kirby-push-notifications. 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 kirby-push-notifications

Kirby Push Notifications

License Version

Kirby Push Notifications is a plugin for Kirby CMS that adds Web Push support. Visitors can subscribe to channels (e.g. “Notes”, “News”), and you can send notifications from the Panel or via hooks. Subscriptions are stored in SQLite; sending is powered by the minishlink/web-push library with VAPID authentication.

Features

Requirements

Installation

Composer (recommended)

In your site root:

Manual installation

  1. Download or clone the repo.
  2. Copy the kirby-push-notifications folder into site/plugins/.

The plugin ships with its own vendor/, so no composer install in the plugin folder is needed.

Configuration

In site/config/config.php (or a separate config file):

Note Defining channels in the plugin options is optional. It is only required if you want to use the built‑in subscription UIs that read channels from the config (like kpn-dialog). If you use the helper script (helper.js), panel buttons or your own custom UI, you can pass channel names directly in your code without configuring them in channels.

Alternative: flat channels (no panel/website groups)

By default, you can configure channels in two groups (panel and website) so the Panel groups them visually. Channels in the website group are exposed to the frontend snippet, while panel channels are only available inside the Panel. If you don’t need this distinction, you can also use a flat list of channels.

VAPID keys

Web Push requires a VAPID key pair. Set vapid.publicKey, vapid.privateKey and vapid.subject (your site URL, e.g. https://yourdomain.com). Keep the private key secret.

Generating keys: Use the Create VAPID keys section in the web-push-php README (OpenSSL in bash or VAPID::createVapidKeys() in PHP).

Option webPush

Optional: Set global defaults for all push sends with the webPush option. Keys: contentType (e.g. application/json), TTL (seconds, e.g. 3600), urgency, topic, batchSize, requestConcurrency. Usually urgency and topic are left null here and set per send via the hook payload (see Payload for send hooks). You can still set global defaults if needed.

Usage

There are two main use cases: website (visitors subscribe) and panel (editors manage or send notifications). Each can be used in a simple way (ready-made UI) or a custom way (your own UI with the same APIs).


Website

Simple: Dialog snippet

Use the kpn-dialog snippet for a button that opens a subscribe/unsubscribe dialog with channel checkboxes. No custom JS needed.

In a template or snippet:

Optional: pass data to override defaults or translations:

Custom: helper.js

If you don’t want the dialog (e.g. a single button with fixed channels, or your own UI), use the helper script. Set window.KPN_CONFIG (vapidPublicKey, subscribeUrl, unsubscribeUrl, swPath), load /assets/kpn/helper.js, then call window.KPN.subscribe(channels) and window.KPN.unsubscribe(). You stay in control of markup and flow; the helper only handles the Web Push API and the plugin routes.


Panel

Simple: View buttons, button components, dialog

The plugin ships with two view buttons (kpn-subscribe, kpn-notification), two button components (kpn-subscribe-button, kpn-notification-button) and one dialog (kpn-subscribe-dialog). Register and place them in your Panel blueprints or views where needed. That’s enough to let logged-in users subscribe/unsubscribe and to send a notification (channel, title, body) without building your own UI. See src/index.js and src/components/ for how they’re wired.

Custom: Your own UI with hooks and API

Build your own Panel UI and call the hooks (subscribe, unsubscribe, send-to-one, send-to-many) and the Panel API (e.g. get-channels, get-keys, status, subscribe, unsubscribe). Same backend, full control over the interface.

Example: send a push when a note is published:


Hooks

Hook Use case
philippoehrlein.push-notifications.subscribe After a subscription is created (payload: endpoint, keys, channel, user_id).
philippoehrlein.push-notifications.unsubscribe After unsubscription (payload: endpoint and/or user_id, channel).
philippoehrlein.push-notifications.send-to-one Send to one user (payload: user_id, message, channel, language?, options?).
philippoehrlein.push-notifications.send-to-many Send to many users or to a full channel (payload: message, user_ids?, channel?, language?, options?).

Payload for send hooks

For send-to-one and send-to-many, the payload can include an optional options array with Web Push options for that send:

Example: 'options' => ['urgency' => 'high', 'TTL' => 600].

Routes and API

License

MIT. See LICENSE for details.

Support


All versions of kirby-push-notifications with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3.0
getkirby/composer-installer Version ^1.2
minishlink/web-push Version ^10.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 philippoehrlein/kirby-push-notifications contains the following files

Loading the files please wait ...