PHPackages                             monciego/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. monciego/laravel-pwa

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

monciego/laravel-pwa
====================

A PWA (Progressive Web App) for Laravel.

v1.0.0(4d ago)29MITPHP &gt;=8.0.0

Since Jul 7Compare

[ Source](https://github.com/monciego/laravel-pwa)[ Packagist](https://packagist.org/packages/monciego/laravel-pwa)[ GitHub Sponsors](https://github.com/monciego)[ RSS](/packages/monciego-laravel-pwa/feed)WikiDiscussions Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

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

[](#laravel-pwa)

Turn your Laravel application into a Progressive Web App with offline support, install prompts, and a fully customizable manifest — all from one package.

Features
--------

[](#features)

- **📱 Install Modal** — A one-time modal prompt asking users to install your app
- **🔔 Install Banner** — A sticky banner on subsequent visits, configurable to **top** or **bottom**
- **⏰ Dismiss Reminder** — Dismiss the banner; it reappears after a configurable interval (default 1 day). Set to `0` to show on every visit
- **🖼️ Config-Driven Manifest** — Auto-generated `manifest.json` with full PWA manifest support (icons, splash screens, shortcuts, screenshots, custom properties)
- **📄 Offline Page** — Custom offline fallback page
- **🛜 Service Worker** — Pre-configured service worker for offline support
- **🍎 iOS Safari Support** — Shows home screen instructions on iOS devices
- **🔒 Browser Guard** — Gracefully skips everything on browsers without service worker support
- **⚡ Livewire Compatible** — Works seamlessly with Livewire (`data-navigate-once` support)
- **🖥️ Artisan Commands** — Simple CLI commands to publish assets and regenerate the manifest

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

[](#requirements)

- PHP &gt;= 8.0
- Laravel 8.x – 13.x

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

[](#installation)

```
composer require monciego/laravel-pwa
```

Laravel will auto-discover the service provider and facade.

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

[](#quick-start)

Publish all PWA assets with a single command:

```
php artisan monciego:install-pwa
```

This publishes:

AssetPathTagConfig`config/pwa.php``monciego:publish-pwa-config`Manifest`public/manifest.json``monciego:publish-manifest`Offline page`public/offline.html``monciego:publish-offline`Service worker`public/sw.js``monciego:publish-sw`App logo`public/logo.png``monciego:publish-logo`Icons`public/images/icons/*.png``monciego:publish-icons`Then generate the manifest from your config:

```
php artisan monciego:update-manifest
```

### Add to Your Layout

[](#add-to-your-layout)

Place these Blade directives in your layout file:

```
{{-- Inside  --}}
@PwaHead

{{-- Before closing  --}}
@RegisterServiceWorkerScript
```

**That's it!** Reload your app and you'll see the install modal on supported browsers.

How the Install Flow Works
--------------------------

[](#how-the-install-flow-works)

1. **First visit** — When the browser detects the app is installable, a **modal** appears:

    ```
    ┌───────────────────────────────┐
    │                               │
    │         [App Icon]            │
    │                               │
    │         Install App           │
    │                               │
    │  Install this app for faster  │
    │  access, offline support,     │
    │  and a better experience.     │
    │                               │
    │  ┌─────────────────────────┐  │
    │  │        Install          │  │
    │  └─────────────────────────┘  │
    │       Maybe later             │
    │                               │
    └───────────────────────────────┘

    ```
2. **Install** — Triggers the browser's native install prompt
3. **Maybe later** — Modal disappears, replaced by a sticky **banner** at the top (or bottom) of the page:

    ```
    ┌──────────────────────────────────────────────────────────┐
    │ Install this app for faster access, offline support, and │
    │ a better experience.                     [Install] [Dismiss]
    └──────────────────────────────────────────────────────────┘

    ```
4. **Dismiss** — Hides the banner for a configurable period (default 1 day), then it reappears
5. **App installed** — Both modal and banner hide permanently

> **Note:** The modal shows only once. After clicking "Maybe later," the banner takes over on all future visits.

### iOS Safari

[](#ios-safari)

On iOS, the browser's native install prompt is not supported. Instead, the modal and banner display instructions guiding the user to tap the Share button and select **Add to Home Screen**.

Blade Directives
----------------

[](#blade-directives)

### `@PwaHead`

[](#pwahead)

Outputs PWA meta tags and install UI styles. Place inside ``:

```

  /* ... install UI styles ... */

```

### `@RegisterServiceWorkerScript`

[](#registerserviceworkerscript)

Outputs the install modal/banner HTML and the service worker registration script. Place before ``.

### Helper Function

[](#helper-function)

```
pwa(); // Returns the PWAService instance
```

### Facade

[](#facade)

```
use PWA;

PWA::headTag();
PWA::registerServiceWorkerScript();
```

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

[](#configuration)

Publish the config to customize:

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

Then edit `config/pwa.php`:

```
