PHP code example of foxws / laravel-pwa
1. Go to this page and download the library: Download foxws/laravel-pwa library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
foxws / laravel-pwa example snippets
// config/pwa.php
return [
'enabled' => env('PWA_ENABLED', true),
'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'),
];
bash
php artisan vendor:publish --tag="pwa-config"
bash
php artisan storage:link
bash
php artisan pwa:generate