### Install laravel-pwa-service-worker with Composer Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Installs the package via Composer. The /sw.js route is registered automatically after installation. ```bash composer require jeffersongoncalves/laravel-pwa-service-worker ``` -------------------------------- ### Handle pwa-updated message and prompt reload Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Listens for the 'pwa-updated' message sent by the new service worker and prompts the user to reload. It ignores the initial install by checking navigator.serviceWorker.controller and guards against reload loops with a 'controllerchange' listener. ```html ``` -------------------------------- ### Publish config and views with artisan vendor:publish Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Optionally publishes the package's config and view files. Run each command separately to publish the respective tag. ```bash php artisan vendor:publish --tag="pwa-service-worker-config" php artisan vendor:publish --tag="pwa-service-worker-views" ``` -------------------------------- ### Run tests with composer test Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Runs the package test suite. ```bash composer test ``` -------------------------------- ### Register service worker in layout Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Registers the service worker from your layout. The /sw.js route is registered automatically by the package. ```html ``` -------------------------------- ### Register offline route Source: https://github.com/jeffersongoncalves/laravel-pwa-service-worker/blob/master/README.md Registers the offline fallback route that the service worker uses when a navigation fails and nothing is cached. The route is intentionally not provided by the package and must be defined by the application. ```php Route::view('/offline', 'offline')->name('pwa.offline'); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.