PHPackages                             anytech/silverstripe-pwa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. anytech/silverstripe-pwa

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

anytech/silverstripe-pwa
========================

Progressive Web App (PWA) module for SilverStripe 4/5 with Web Manifest, Service Worker, and Push Notifications support

1620↓50%1PHP

Since Dec 17Pushed 4mo agoCompare

[ Source](https://github.com/anytech/silverstripe-pwa)[ Packagist](https://packagist.org/packages/anytech/silverstripe-pwa)[ RSS](/packages/anytech-silverstripe-pwa/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SilverStripe PWA Module
=======================

[](#silverstripe-pwa-module)

A zero-dependency Progressive Web App (PWA) module for SilverStripe 4 and 5. Add installable app capabilities, offline support, and push notifications to your SilverStripe website.

Features
--------

[](#features)

- **Web App Manifest** - Dynamically generated manifest with full CMS configuration
- **Service Worker** - Offline-first strategy with customizable caching
- **Push Notifications** - Native PHP Web Push implementation (no external libraries)
- **VAPID Key Generation** - Generate keys directly from the CMS
- **Installable** - Make your site installable on mobile and desktop
- **Modern Standards** - Follows 2025 PWA best practices
- **Zero Dependencies** - Only requires SilverStripe and PHP extensions

Requirements
------------

[](#requirements)

- PHP 8.0+
- PHP Extensions: `openssl`, `curl`
- SilverStripe CMS 4.10+ or 5.x
- HTTPS (required for service workers and push notifications)

Installation
------------

[](#installation)

```
composer require anytech/silverstripe-pwa
```

After installation, run the database migration:

```
vendor/bin/sake dev/build flush=1
```

Quick Start
-----------

[](#quick-start)

### 1. Add PWA Meta Tags

[](#1-add-pwa-meta-tags)

Add the following to your page template's `` section (typically `Page.ss` or `Header.ss`):

```

```

### 2. Configure in CMS

[](#2-configure-in-cms)

Navigate to **Settings &gt; Manifest** in the SilverStripe CMS to configure:

#### Core Settings

[](#core-settings)

- **App Name** - Full name displayed in install prompts
- **Short Name** - Name shown on home screen (max 12 characters)
- **Description** - App description for store listings

#### Appearance

[](#appearance)

- **Theme Color** - Browser UI color (address bar, status bar)
- **Background Color** - Splash screen background
- **Display Mode** - How the app appears (standalone recommended)
- **Orientation** - Screen orientation preference

#### Icons

[](#icons)

- **App Icon** - Square PNG/SVG, minimum 512x512px
- **Maskable Icon** - Adaptive icon for Android with safe zone padding

#### Screenshots (Optional)

[](#screenshots-optional)

- **Wide Screenshot** - Desktop/tablet screenshot (landscape)
- **Narrow Screenshot** - Mobile screenshot (portrait)

### 3. Generate VAPID Keys (for Push Notifications)

[](#3-generate-vapid-keys-for-push-notifications)

VAPID keys are required for push notifications. You can generate them directly from the CMS:

1. Go to **Settings &gt; Manifest**
2. Scroll to **Push Notification Settings**
3. Click **Generate VAPID Keys**
4. Click **Save**

That's it! No command line or external tools needed.

### 4. Configure VAPID Subject

[](#4-configure-vapid-subject)

In **Settings &gt; Manifest**, set your **VAPID Subject** to a contact email (e.g., `mailto:admin@yoursite.com`).

Push Notifications
------------------

[](#push-notifications)

### Enabling Push on Pages

[](#enabling-push-on-pages)

To allow push notifications when publishing specific page types, add the extension in your `app/_config/config.yml`:

```
App\Models\BlogPost:
  extensions:
    - SilverStripePWA\Extensions\PushPageExtension

Page:
  extensions:
    - SilverStripePWA\Extensions\PushPageExtension
```

When editing a page with this extension, you'll see a "Send Push Notification" checkbox. Checking this before publishing will send a notification to all subscribers.

### Sending Push Notifications from Code

[](#sending-push-notifications-from-code)

Use `PushNotificationService` to send notifications from anywhere in your application:

```
use SilverStripePWA\Services\PushNotificationService;

// Simple: Send to all subscribers
PushNotificationService::notify('New Update', 'Check out the latest features!');

// Send to a specific member
$member = Member::get()->byID(123);
PushNotificationService::notifyMember($member, 'Hello!', 'You have a new message');

// Send to multiple members
$members = Member::get()->filter('GroupID', 5);
PushNotificationService::notifyMembers($members, 'Team Update', 'New task assigned');

// Full control with fluent API
PushNotificationService::create()
    ->setTitle('Order Shipped')
    ->setBody('Your order #1234 has been shipped!')
    ->setUrl('/account/orders/1234')
    ->setIcon('/assets/icons/shipping.png')
    ->setTag('order-1234')  // Groups/replaces notifications with same tag
    ->setData(['orderId' => 1234])
    ->sendToMember($member);
```

### Member-Targeted Notifications

[](#member-targeted-notifications)

Subscribers are automatically linked to logged-in members. This enables targeted notifications:

```
// When a user receives a message
public function onMessageReceived(Message $message)
{
    PushNotificationService::notifyMember(
        $message->Recipient(),
        'New Message',
        "From: {$message->Sender()->Name}",
        $message->Link()
    );
}

// When sending an email, also send a push
public function sendOrderConfirmation(Order $order)
{
    // Send email
    $email = Email::create()->to($order->Customer()->Email);
    $email->send();

    // Also send push notification
    PushNotificationService::notifyMember(
        $order->Customer(),
        'Order Confirmed',
        "Order #{$order->ID} has been confirmed",
        $order->Link()
    );
}
```

### Push Notification Settings

[](#push-notification-settings)

Configure push notification defaults in **Settings &gt; PushNotifications**:

- **Message** - Default notification body text
- **TTL** - Time to live in seconds
- **Vibration Pattern** - Device vibration pattern
- **Icon** - Notification icon (512x512px)
- **Badge** - Monochrome badge icon (128x128px)

API Endpoints
-------------

[](#api-endpoints)

The module exposes the following endpoints:

EndpointMethodDescription`/manifest.json`GETWeb app manifest`/service-worker.js`GETService worker script`/RegisterServiceWorker.js`GETService worker registration script`/offline.html`GETOffline fallback page`/RegisterSubscription`POSTRegister push subscription`/push`POSTSend push notification (internal)Manifest Properties
-------------------

[](#manifest-properties)

The generated manifest includes modern PWA properties:

```
{
  "name": "Your App Name",
  "short_name": "App",
  "description": "Your app description",
  "start_url": "/",
  "id": "/",
  "display": "standalone",
  "orientation": "any",
  "theme_color": "#ffffff",
  "background_color": "#ffffff",
  "lang": "en",
  "categories": ["business"],
  "icons": [...],
  "screenshots": [...]
}
```

Service Worker
--------------

[](#service-worker)

The service worker implements:

- **Network-first strategy** - Always tries network, falls back to cache
- **Offline page** - Custom offline page when network unavailable
- **Push notifications** - Receives and displays push messages
- **Cache management** - Automatic cleanup of old caches
- **Message handling** - Skip waiting and cache clearing via postMessage

Browser Support
---------------

[](#browser-support)

FeatureChromeFirefoxSafariEdgeManifestYesYesYesYesService WorkerYesYesYesYesPush NotificationsYesYesLimitedYesInstall PromptYesNoLimitedYesTroubleshooting
---------------

[](#troubleshooting)

### Service Worker Not Registering

[](#service-worker-not-registering)

- Ensure your site is served over HTTPS
- Check browser console for errors
- Verify `/service-worker.js` returns valid JavaScript

### Push Notifications Not Working

[](#push-notifications-not-working)

- Generate VAPID keys in Settings &gt; Manifest
- Check that VAPID subject is configured (must be a mailto: URL)
- Ensure user has granted notification permissions
- Check browser support for Web Push

### Manifest Not Loading

[](#manifest-not-loading)

- Verify `/manifest.json` returns valid JSON
- Check for CORS issues if using CDN
- Ensure app icon is uploaded and published

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This module is licensed under the MIT License. See [LICENSE](LICENSE) for details.

Author
------

[](#author)

**Kayne Middleton**[Anytech](https://anytech.ca)

Links
-----

[](#links)

- [GitHub Repository](https://github.com/anytech/silverstripe-pwa)
- [Issue Tracker](https://github.com/anytech/silverstripe-pwa/issues)
- [PWA Documentation (MDN)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
- [Web App Manifest Reference](https://developer.mozilla.org/en-US/docs/Web/Manifest)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance50

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 67.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5088b2c0269fdffb8151099324097ff383178dc2df03a6016c719822be478656?d=identicon)[Anytech](/maintainers/Anytech)

---

Top Contributors

[![michieldiederen](https://avatars.githubusercontent.com/u/17616284?v=4)](https://github.com/michieldiederen "michieldiederen (58 commits)")[![anytech](https://avatars.githubusercontent.com/u/6244070?v=4)](https://github.com/anytech "anytech (28 commits)")

### Embed Badge

![Health badge](/badges/anytech-silverstripe-pwa/health.svg)

```
[![Health](https://phpackages.com/badges/anytech-silverstripe-pwa/health.svg)](https://phpackages.com/packages/anytech-silverstripe-pwa)
```

###  Alternatives

[wordpress/phpdoc-parser

Static code parser for WordPress source.

24220.0k](/packages/wordpress-phpdoc-parser)[nickford/acf-swatch

This is a simple ACF Add-on field allowing the creation of color swatches that behave as radio buttons.

7610.2k1](/packages/nickford-acf-swatch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
