PHPackages                             foxws/laravel-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. [Templating &amp; Views](/categories/templating)
4. /
5. foxws/laravel-pwa

ActiveLibrary[Templating &amp; Views](/categories/templating)

foxws/laravel-pwa
=================

PWA manifest and Blade directives for Laravel.

2.0.0(1mo ago)1711↑132.1%[1 PRs](https://github.com/foxws/laravel-pwa/pulls)MITPHPPHP ^8.3CI passing

Since Mar 3Pushed 1mo agoCompare

[ Source](https://github.com/foxws/laravel-pwa)[ Packagist](https://packagist.org/packages/foxws/laravel-pwa)[ Docs](https://github.com/foxws/laravel-pwa)[ GitHub Sponsors](https://github.com/Foxws)[ RSS](/packages/foxws-laravel-pwa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (16)Used By (0)

Laravel PWA
===========

[](#laravel-pwa)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a990751699fd426e0b452283608d07a1eb0d669dc39f31a97fbe2853a6a37a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f7877732f6c61726176656c2d7077612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-pwa)[![GitHub Tests Action Status](https://camo.githubusercontent.com/06b9a1f39f13ff55c4b1f36226e567300c7d2be403c7da76dd561661f8f92a3d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d7077612f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-pwa/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/506bea0f5ee95f33b898b98929cbf7fd4e62b290f1127b70958e032591006627/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d7077612f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-pwa/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a6abd5d39759e2fddffccc9593a481f56245495adb29c098b4bd4b5631445cb9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f7877732f6c61726176656c2d7077612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-pwa)

A minimal, opinionated Progressive Web App (PWA) package for Laravel. It provides Blade directives for the PWA head and service worker registration, and an Artisan command to generate your `manifest.json` and publish a `sw.js` stub.

The included service worker uses a network-first strategy for navigation and cache-first for static assets, while intentionally bypassing the cache for [Inertia.js](https://inertiajs.com) (`X-Inertia`) and [Livewire](https://livewire.laravel.com) (`X-Livewire`) requests to prevent stale responses.

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

[](#installation)

```
composer require foxws/laravel-pwa
```

Publish the config file:

```
php artisan vendor:publish --tag="pwa-config"
```

Usage
-----

[](#usage)

### Blade directives

[](#blade-directives)

Add `@pwaHead` inside your `` and `@pwaSw` just before ``:

```

    @pwaHead

    ...
    @pwaSw

```

This renders the theme-color meta tag, apple-touch-icon, manifest link, and the service worker registration script.

Both directives accept optional overrides:

```
@pwaHead(['themeColor' => '#ff0000', 'manifest' => '/custom.json'])

@pwaSw(['swPath' => '/sw.js', 'scope' => '/', 'debug' => true])
```

Or use them as Blade components:

```

```

The `@pwaSw` directive automatically picks up the CSP nonce from `Vite::cspNonce()` when set.

### Icons

[](#icons)

Icons are defined in a dedicated `icons` array in `config/pwa.php`, separate from the manifest. Each entry supports a `disk` key pointing to any configured Laravel filesystem disk. The `src` URL is resolved at generation time via `Storage::disk()->url()`. Set `disk` to `null` to fall back to `path` used as-is.

The default configuration assumes three icons — a **mobile** icon (192×192), a **desktop** icon (512×512), and an **apple-touch-icon**. Create the storage symlink and place all files there:

```
php artisan storage:link
```

```
$ ls storage/app/public/images/icons
storage/app/public/images/icons/apple-touch-icon.png
storage/app/public/images/icons/icon-192x192.png
storage/app/public/images/icons/icon-512x512.png
```

You can override each icon independently via `.env`:

```
PWA_ICON_MOBILE_PATH=/storage/images/icons/icon-192x192.png
PWA_ICON_DESKTOP_PATH=/storage/images/icons/icon-512x512.png
PWA_APPLE_TOUCH_ICON=/storage/images/icons/apple-touch-icon.png
```

For S3 or other remote disks, set the respective `_DISK` variable to the disk name — the URL will be resolved accordingly. Each icon can live on a different disk.

### Generating the manifest and service worker

[](#generating-the-manifest-and-service-worker)

```
php artisan pwa:generate
```

This writes `public/manifest.json` from your config, and copies the `sw.js` stub to `public/sw.js`. Both paths are configurable via `config/pwa.php`.

The service worker serves an offline fallback page from `public/offline.html`. You must create this file yourself — see [examples/offline.html](examples/offline.html) for a starting point.

Configuration
-------------

[](#configuration)

```
// config/pwa.php

return [
    'manifest_path' => env('PWA_MANIFEST_PATH', 'manifest.json'),
    'sw_path'       => env('PWA_SW_PATH', 'sw.js'),
    'ignore_paths'  => ['/api/', '/livewire/', '/_inertia/'],
    'manifest' => [
        'id'             => env('PWA_ID', '/'),
        'name'           => env('APP_NAME', 'Laravel'),
        'short_name'     => env('PWA_SHORT_NAME', 'Laravel'),
        'description'    => env('PWA_DESCRIPTION', 'A Progressive Web Application setup for Laravel projects.'),
        'start_url'      => env('PWA_START_URL', '/'),
        'scope'          => env('PWA_SCOPE', '/'),
        'display_override' => ['fullscreen', 'standalone'],
        'display'        => env('PWA_DISPLAY', 'fullscreen'),
        'orientation'    => env('PWA_ORIENTATION', 'any'),
        'background_color' => env('PWA_BACKGROUND_COLOR', '#ffffff'),
        'theme_color'    => env('PWA_THEME_COLOR', '#6777ef'),
        'lang'           => env('PWA_LANG', 'en'),
        'dir'            => env('PWA_DIR', 'ltr'),
    ],
    'icons' => [
        // Mobile icon
        [
            'disk'  => env('PWA_ICON_DISK', null),
            'path'  => env('PWA_ICON_MOBILE_PATH', '/storage/images/icons/icon-192x192.png'),
            'sizes' => env('PWA_ICON_MOBILE_SIZES', '192x192'),
            'type'  => env('PWA_ICON_MOBILE_TYPE', 'image/png'),
        ],
        // Desktop icon
        [
            'disk'  => env('PWA_ICON_DISK', null),
            'path'  => env('PWA_ICON_DESKTOP_PATH', '/storage/images/icons/icon-512x512.png'),
            'sizes' => env('PWA_ICON_DESKTOP_SIZES', '512x512'),
            'type'  => env('PWA_ICON_DESKTOP_TYPE', 'image/png'),
        ],
    ],
    'apple_touch_icon' => env('PWA_APPLE_TOUCH_ICON', '/storage/images/icons/apple-touch-icon.png'),
];
```

Any key set to `null` in the manifest array is omitted from the generated JSON. Advanced keys such as `shortcuts`, `screenshots`, and `categories` can be added to the manifest array as needed.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [francoism90](https://github.com/foxws)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.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 ~1 days

Total

14

Last Release

56d ago

Major Versions

0.0.3 → 1.0.02026-03-03

1.9.0 → 2.0.02026-03-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5028905?v=4)[François M.](/maintainers/francoism90)[@francoism90](https://github.com/francoism90)

---

Top Contributors

[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (42 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

installablelaravelmobileprogressive-web-apppwalaravelbladepwamanifestservice workerProgressive Web Applaravel pwafoxws

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/foxws-laravel-pwa/health.svg)

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

###  Alternatives

[erag/laravel-pwa

A simple and easy-to-use PWA (Progressive Web App) package for Laravel applications.

16083.3k](/packages/erag-laravel-pwa)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[devrabiul/laravel-pwa-kit

Laravel PWA Kit is a lightweight and flexible package to add Progressive Web App (PWA) support to your Laravel applications with ease.

571.4k](/packages/devrabiul-laravel-pwa-kit)[daikazu/laravel-glider

Start using Glide on-the-fly instantly in your Laravel blade templates.

882.3k](/packages/daikazu-laravel-glider)[alareqi/filament-pwa

A comprehensive PWA (Progressive Web App) plugin for Filament v3 and v4 admin panels with offline functionality, installation prompts, and icon generation.

132.9k](/packages/alareqi-filament-pwa)

PHPackages © 2026

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