PHPackages                             m2-boilerplate/module-service-worker - 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. m2-boilerplate/module-service-worker

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

m2-boilerplate/module-service-worker
====================================

A Magento 2 extension that adds Service Worker support.

3.0.0(5y ago)04MITPHP

Since Jan 31Pushed 5y agoCompare

[ Source](https://github.com/m2-boilerplate/Module-Service-Worker)[ Packagist](https://packagist.org/packages/m2-boilerplate/module-service-worker)[ RSS](/packages/m2-boilerplate-module-service-worker/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (14)Used By (0)

M2Boilerplate ServiceWorker
===========================

[](#m2boilerplate-serviceworker)

A Magento 2 extension that adds [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) support.

Features:

- Fully customisable Service Worker script
- Cache-first approach for page assets resulting in faster page loads
- Offline cms page, when no network is available

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

[](#installation)

Add this extension to your Magento installation with Composer:

```
composer require m2-boilerplate/module-service-worker

```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

The Service Worker is configured and enabled by default. However, Service Workers require the site to run on HTTPS.

Features can be customised in *Stores &gt; Configuration &gt; General &gt; Web &gt; Service Worker Settings*.

### Adding more logic

[](#adding-more-logic)

If the base service worker file doesn't fit all of your needs you can easily add more logic using the layout system, targeting the `serviceworker_index_js` handle:

```

```

FAQ
---

[](#faq)

### Why do page assets not appear to be cached when Magento is in default/developer mode?

[](#why-do-page-assets-not-appear-to-be-cached-when-magento-is-in-defaultdeveloper-mode)

Magento 2 uses a timestamp version string in the URL for static files to allow busting browser cache when the static content gets updated. In developer mode, this version string is updated for every unique page request. This means that from the browser's perspective, the static assets, such as CSS files, are completely different on each page, even though the content is the same. Therefore, when the assets get cached by the Service Worker in Magento 2 developer mode, they only get cached for that specific page. Production mode only generates the static assets through command line and keeps the version timestamp fixed, so it doesn't experience this issue.

### Testing Service Workers on Chrome

[](#testing-service-workers-on-chrome)

Chrome is very strict about security and only allows Service Workers on localhost, or on an HTTPS site with a valid certificate. To bypass these restrictions for testing, use the `--ignore-certificate-errors` and `--unsafely-treat-insecure-origin-as-secure` flags to run a less secure copy of Chrome:

```
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
    --user-data-dir=/tmp/chrome \
    --ignore-certificate-errors \
    --unsafely-treat-insecure-origin-as-secure=https://m2-meanbee-serviceworker.docker/

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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.

###  Release Activity

Cadence

Every ~183 days

Recently: every ~249 days

Total

8

Last Release

2156d ago

Major Versions

1.1.0 → 2.0.02017-06-20

2.2.0 → 3.0.02020-08-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/761744?v=4)[Thomas Hampe](/maintainers/thampe)[@thampe](https://github.com/thampe)

---

Top Contributors

[![tgerulaitis](https://avatars.githubusercontent.com/u/613076?v=4)](https://github.com/tgerulaitis "tgerulaitis (39 commits)")[![thampe](https://avatars.githubusercontent.com/u/761744?v=4)](https://github.com/thampe "thampe (3 commits)")[![punkstar](https://avatars.githubusercontent.com/u/179072?v=4)](https://github.com/punkstar "punkstar (2 commits)")[![brosenberger](https://avatars.githubusercontent.com/u/2969243?v=4)](https://github.com/brosenberger "brosenberger (1 commits)")

### Embed Badge

![Health badge](/badges/m2-boilerplate-module-service-worker/health.svg)

```
[![Health](https://phpackages.com/badges/m2-boilerplate-module-service-worker/health.svg)](https://phpackages.com/packages/m2-boilerplate-module-service-worker)
```

###  Alternatives

[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68357.9k](/packages/run-as-root-magento2-prometheus-exporter)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1011.8k26](/packages/loki-magento2-components)[mollie/magento2

Mollie Payment Module for Magento 2

1131.9M16](/packages/mollie-magento2)[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

282822.9k](/packages/baldwin-magento2-module-url-data-integrity-checker)[angeo/module-llms-txt

Magento 2 module for AI Engine Optimization (AEO). Generates spec-compliant llms.txt and llms-full.txt per llmstxt.org standard, plus streaming JSONL for vector indexing. Multi-store, multi-website, CLI, cron, async admin UI, Page Builder-aware sanitization, customer-group pricing, atomic writes, ETag/Cache-Control, .md mirrors.

111.1k](/packages/angeo-module-llms-txt)[zwernemann/module-withdrawal

Magento 2 EU Withdrawal Button Module - Adds a withdrawal/revocation button for orders in compliance with EU Directive (EU) 2023/2673

245.0k2](/packages/zwernemann-module-withdrawal)

PHPackages © 2026

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