Download the PHP package slfomin/pwa-laravel without Composer

On this page you can find all versions of the php package slfomin/pwa-laravel. 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 pwa-laravel

pwa-laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status PHPStan Total Downloads

Full PWA integration for Laravel 13 + Vite 7 with optional Inertia.js v3 support.

Requirements

Dependency Version
PHP ^8.4
Laravel ^13.0
Vite ^6.0 || ^7.0
vite-plugin-pwa ^1.0
Inertia.js (optional) ^3.0

Installation

Run the interactive installer:

This publishes config/pwa.php and prints the next steps.

Quick Start

1. Place your source icon

Put a square PNG (512×512 or larger) at resources/images/pwa-icon.png, then generate all sizes:

Icons are written to public/icons/ and cover standard, maskable, Apple Touch, and favicon sizes.

2. Add Blade directives to your layout

@pwaMeta renders the <link rel="manifest">, theme-color, apple-touch-icon, favicons, and other mobile meta tags.

@pwaRegisterSW injects a small inline script that registers the service worker on page load.

3. Install the JS companion

Via npm (recommended):

From the composer package (no npm required):

Pre-built files are shipped inside the composer package at vendor/slfomin/pwa-laravel/dist/. Import directly in vite.config.js:

vite-plugin-pwa is still a required peer dependency — install it with ddev npm install -D vite-plugin-pwa.

4. Configure Vite

5. Build

That's it — your Laravel app is now a PWA.


Inertia.js v3 Integration

Vite config

Shared props

The package automatically calls Inertia::share('pwa', ...) if Inertia is installed and pwa.inertia.auto_detect is true (default). Every page receives:

usePwa() — Vue 3

usePwa() — React 19

Middleware

Add pwa.inertia to your routes to set correct Vary and Cache-Control headers, preventing the service worker from caching Inertia XHR responses:


Dynamic Manifest

Switch the driver to dynamic to serve a manifest generated by Laravel on each request:

Implement your resolver:

Bind it in AppServiceProvider:


PWA Shortcuts

Shortcuts are quick-action entries shown in the OS context menu (long-press / right-click on the app icon). Declare them with #[PwaShortcut] on any controller method that is mapped to a route:

See docs/shortcuts.md for the full reference.


Blade Directives

Directive Output
@pwaMeta <link rel="manifest">, theme-color, apple-touch-icon, favicons, mobile meta
@pwaRegisterSW Inline <script> registering the service worker
@pwaInstallButton('Install') A hidden <button> that appears when the browser's install prompt fires

Artisan Commands

Command Description
pwa:install Interactive installer — publishes config and prints next steps
pwa:generate-icons Generate full icon set from source PNG
pwa:publish-manifest Write manifest.webmanifest from config (no Vite build required)
pwa:shortcuts:list List all discovered PWA shortcuts (--no-cache to bypass cache)
pwa:shortcuts:cache Discover shortcuts and cache the result for production
pwa:shortcuts:clear Flush the shortcuts cache

pwa:generate-icons

pwa:publish-manifest


Configuration Reference

All options live in config/pwa.php. Key .env variables:

Variable Default Description
PWA_MANIFEST_DRIVER static static (Vite file) or dynamic (Laravel controller)
PWA_MANIFEST_ROUTE /manifest.webmanifest URL the browser fetches
APP_NAME Laravel PWA full name
PWA_SHORT_NAME APP_NAME Short name for the home screen icon
PWA_DESCRIPTION `` PWA description
PWA_DISPLAY standalone Display mode (standalone, fullscreen, minimal-ui, browser)
PWA_THEME_COLOR #000000 Theme / status-bar color
PWA_BG_COLOR #ffffff Splash screen background color
PWA_SW_STRATEGY generateSW generateSW or injectManifest
PWA_SW_URL /sw.js Service worker registration URL
PWA_SW_DEV false Enable service worker in local dev
PWA_MANIFEST_CACHE true Cache dynamic manifest responses
PWA_MANIFEST_CACHE_TTL 3600 Cache TTL in seconds
PWA_SHORTCUTS_CACHE null Cache discovered shortcuts (true/false; null = auto by APP_ENV)

Facade & Contracts

Extension points in SlFomin\PwaLaravel\Contracts:

Contract Purpose
ManifestDriver Custom manifest delivery strategy
ManifestResolver Context-aware manifests (tenant, locale, user role)
IconGenerator Replace intervention/image with another library
ServiceWorkerStrategy Extend Vite plugin options

Events

Hook into the PWA lifecycle with five Laravel events (ManifestResolving, ManifestResolved, ServiceWorkerRequested, IconsGenerated, ManifestPublished):

See docs/events.md for the full reference.


Testing


Changelog

Please see CHANGELOG for recent changes.

Contributing

Please see CONTRIBUTING for details.

Security

Please review our security policy to report vulnerabilities.

Credits

License

MIT. Please see License File for more information.


All versions of pwa-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
spatie/laravel-package-tools Version ^1.93
illuminate/contracts Version ^13.0
illuminate/support Version ^13.0
illuminate/http Version ^13.0
illuminate/routing Version ^13.0
intervention/image Version ^3.10
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 slfomin/pwa-laravel contains the following files

Loading the files please wait ...