├── .gitignore
├── Config
└── config.php
├── Console
└── DeployManifest.php
├── Http
├── Controllers
│ └── LaravelPWAController.php
└── routes.php
├── LICENSE
├── Providers
├── LaravelPWAServiceProvider.php
└── RouteServiceProvider.php
├── README.md
├── Services
├── ManifestService.php
└── MetaService.php
├── Tests
└── .gitkeep
├── assets
├── images
│ └── icons
│ │ ├── icon-128x128.png
│ │ ├── icon-144x144.png
│ │ ├── icon-152x152.png
│ │ ├── icon-192x192.png
│ │ ├── icon-384x384.png
│ │ ├── icon-512x512.png
│ │ ├── icon-72x72.png
│ │ ├── icon-96x96.png
│ │ ├── splash-1125x2436.png
│ │ ├── splash-1242x2208.png
│ │ ├── splash-1242x2688.png
│ │ ├── splash-1536x2048.png
│ │ ├── splash-1668x2224.png
│ │ ├── splash-1668x2388.png
│ │ ├── splash-2048x2732.png
│ │ ├── splash-640x1136.png
│ │ ├── splash-750x1334.png
│ │ └── splash-828x1792.png
└── js
│ └── serviceworker.js
├── composer.json
├── database
├── migrations
│ └── .gitkeep
└── seeders
│ └── .gitkeep
├── module.json
├── resources
└── views
│ ├── meta.blade.php
│ └── offline.blade.php
└── start.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 |
--------------------------------------------------------------------------------
/Config/config.php:
--------------------------------------------------------------------------------
1 | 'LaravelPWA',
5 | 'manifest' => [
6 | 'name' => env('APP_NAME', 'My PWA App'),
7 | 'short_name' => 'PWA',
8 | 'start_url' => '/',
9 | 'background_color' => '#ffffff',
10 | 'theme_color' => '#000000',
11 | 'display' => 'standalone',
12 | 'orientation'=> 'any',
13 | 'status_bar'=> 'black',
14 | 'icons' => [
15 | '72x72' => [
16 | 'path' => '/images/icons/icon-72x72.png',
17 | 'purpose' => 'any'
18 | ],
19 | '96x96' => [
20 | 'path' => '/images/icons/icon-96x96.png',
21 | 'purpose' => 'any'
22 | ],
23 | '128x128' => [
24 | 'path' => '/images/icons/icon-128x128.png',
25 | 'purpose' => 'any'
26 | ],
27 | '144x144' => [
28 | 'path' => '/images/icons/icon-144x144.png',
29 | 'purpose' => 'any'
30 | ],
31 | '152x152' => [
32 | 'path' => '/images/icons/icon-152x152.png',
33 | 'purpose' => 'any'
34 | ],
35 | '192x192' => [
36 | 'path' => '/images/icons/icon-192x192.png',
37 | 'purpose' => 'any'
38 | ],
39 | '384x384' => [
40 | 'path' => '/images/icons/icon-384x384.png',
41 | 'purpose' => 'any'
42 | ],
43 | '512x512' => [
44 | 'path' => '/images/icons/icon-512x512.png',
45 | 'purpose' => 'any'
46 | ],
47 | ],
48 | 'splash' => [
49 | '640x1136' => '/images/icons/splash-640x1136.png',
50 | '750x1334' => '/images/icons/splash-750x1334.png',
51 | '828x1792' => '/images/icons/splash-828x1792.png',
52 | '1125x2436' => '/images/icons/splash-1125x2436.png',
53 | '1242x2208' => '/images/icons/splash-1242x2208.png',
54 | '1242x2688' => '/images/icons/splash-1242x2688.png',
55 | '1536x2048' => '/images/icons/splash-1536x2048.png',
56 | '1668x2224' => '/images/icons/splash-1668x2224.png',
57 | '1668x2388' => '/images/icons/splash-1668x2388.png',
58 | '2048x2732' => '/images/icons/splash-2048x2732.png',
59 | ],
60 | 'shortcuts' => [
61 | [
62 | 'name' => 'Shortcut Link 1',
63 | 'description' => 'Shortcut Link 1 Description',
64 | 'url' => '/shortcutlink1',
65 | 'icons' => [
66 | "src" => "/images/icons/icon-72x72.png",
67 | "purpose" => "any"
68 | ]
69 | ],
70 | [
71 | 'name' => 'Shortcut Link 2',
72 | 'description' => 'Shortcut Link 2 Description',
73 | 'url' => '/shortcutlink2'
74 | ]
75 | ],
76 | 'custom' => []
77 | ]
78 | ];
79 |
--------------------------------------------------------------------------------
/Console/DeployManifest.php:
--------------------------------------------------------------------------------
1 | generate();
45 | File::put(public_path("manifest.json"), json_encode($output, JSON_PRETTY_PRINT));
46 |
47 | $this->line('manifest.json file has been created.');
48 |
49 | }
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/Http/Controllers/LaravelPWAController.php:
--------------------------------------------------------------------------------
1 | generate();
15 | return response()->json($output);
16 | }
17 |
18 | public function offline(){
19 | return view('laravelpwa::offline');
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Http/routes.php:
--------------------------------------------------------------------------------
1 | 'laravelpwa.'], function()
4 | {
5 | Route::get('/manifest.json', 'LaravelPWAController@manifestJson')
6 | ->name('manifest');
7 | Route::get('/offline/', 'LaravelPWAController@offline');
8 | });
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Silvio Luis
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Providers/LaravelPWAServiceProvider.php:
--------------------------------------------------------------------------------
1 | registerConfig();
26 | $this->registerIcons();
27 | $this->registerViews();
28 | $this->registerServiceworker();
29 | $this->registerDirective();
30 | $this->registerCommands();
31 | }
32 |
33 | /**
34 | * Register the service provider.
35 | *
36 | * @return void
37 | */
38 | public function register()
39 | {
40 | $this->app->register(RouteServiceProvider::class);
41 | }
42 |
43 | /**
44 | * Register config.
45 | *
46 | * @return void
47 | */
48 | protected function registerConfig()
49 | {
50 | $this->publishes([
51 | __DIR__.'/../Config/config.php' => config_path('laravelpwa.php'),
52 | ], 'config');
53 | $this->mergeConfigFrom(
54 | __DIR__.'/../Config/config.php', 'laravelpwa'
55 | );
56 | }
57 |
58 | /**
59 | * Register views.
60 | *
61 | * @return void
62 | */
63 | public function registerViews()
64 | {
65 | $viewPath = base_path('resources/views/vendor/laravelpwa');
66 |
67 | $sourcePath = __DIR__.'/../resources/views';
68 |
69 | $this->publishes([
70 | $sourcePath => $viewPath
71 | ], 'views');
72 |
73 | $this->loadViewsFrom(array_merge(array_map(function ($path) {
74 | return $path . '/vendor/laravelpwa';
75 | }, \Config::get('view.paths')), [$sourcePath]), 'laravelpwa');
76 | }
77 |
78 | /**
79 | * Register config.
80 | *
81 | * @return void
82 | */
83 | protected function registerIcons()
84 | {
85 | $iconsPath = public_path('images/icons');
86 |
87 | $sourcePath = __DIR__.'/../assets/images/icons';
88 |
89 | $this->publishes([
90 | $sourcePath => $iconsPath
91 | ], 'icons');
92 | }
93 |
94 | /**
95 | * Register serviceworker.js.
96 | *
97 | * @return void
98 | */
99 | protected function registerServiceworker()
100 | {
101 | $publicPath = public_path();
102 |
103 | $sourcePath = __DIR__.'/../assets/js';
104 |
105 | $this->publishes([
106 | $sourcePath => $publicPath
107 | ], 'serviceworker');
108 | }
109 |
110 | /**
111 | * Register directive.
112 | *
113 | * @return void
114 | */
115 | public function registerDirective()
116 | {
117 | Blade::directive('laravelPWA', function () {
118 | return (new \LaravelPWA\Services\MetaService)->render();
119 | });
120 | }
121 |
122 |
123 | /**
124 | * Register the available commands
125 | *
126 | * @return void
127 | */
128 | public function registerCommands()
129 | {
130 | $this->commands([
131 | \LaravelPWA\Console\Commands\DeployManifest::class,
132 | ]);
133 |
134 | }
135 |
136 | /**
137 | * Get the services provided by the provider.
138 | *
139 | * @return array
140 | */
141 | public function provides()
142 | {
143 | return [];
144 | }
145 | }
--------------------------------------------------------------------------------
/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'web', 'namespace' => $this->rootUrlNamespace], function()
38 | {
39 | require __DIR__ . '/../Http/routes.php';
40 | });
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Laravel (PWA) Progressive Web Application
2 |
3 | [](https://laravel.com/docs/5.8)
4 | [](https://laravel.com/docs/6.x)
5 | [](https://laravel.com)
6 | [](https://packagist.org/packages/silviolleite/laravelpwa)
7 | [](https://packagist.org/packages/silviolleite/laravelpwa)
8 | [](https://packagist.org/packages//silviolleite/laravelpwa)
9 |
10 | This Laravel package turns your project into a [progressive web app](https://developers.google.com/web/progressive-web-apps/). Navigating to your site on an Android phone will prompt you to add the app to your home screen.
11 |
12 | Launching the app from your home screen will display your app. As such, it's critical that your application provides all navigation within the HTML (no reliance on the browser back or forward button).
13 |
14 | See too the [Laravel PWA Demo](https://github.com/silviolleite/laravel-pwa-demo)
15 |
16 |
17 | Requirements
18 | =====
19 | Progressive Web Apps require HTTPS unless being served from localhost. If you're not already using HTTPS on your site, check out [Let's Encrypt](https://letsencrypt.org/) and [ZeroSSL](https://zerossl.com/).
20 |
21 | ## Installation
22 |
23 | Add the following to your `composer.json` file :
24 |
25 | ```json
26 | "require": {
27 | "silviolleite/laravelpwa": "~2.0.3",
28 | },
29 | ```
30 |
31 | or execute
32 |
33 | ```bash
34 | composer require silviolleite/laravelpwa --prefer-dist
35 | ```
36 |
37 | ### Publish
38 |
39 | ```bash
40 | $ php artisan vendor:publish --provider="LaravelPWA\Providers\LaravelPWAServiceProvider"
41 | ```
42 |
43 | ### Configuration
44 |
45 | Configure your app name, description, icons and splashes in `config/laravelpwa.php`.
46 |
47 | ```php
48 | 'manifest' => [
49 | 'name' => env('APP_NAME', 'My PWA App'),
50 | 'short_name' => 'PWA',
51 | 'start_url' => '/',
52 | 'background_color' => '#ffffff',
53 | 'theme_color' => '#000000',
54 | 'display' => 'standalone',
55 | 'orientation' => 'any',
56 | 'status_bar' => 'black',
57 | 'icons' => [
58 | '72x72' => [
59 | 'path' => '/images/icons/icon-72x72.png',
60 | 'purpose' => 'any'
61 | ],
62 | '96x96' => [
63 | 'path' => '/images/icons/icon-96x96.png',
64 | 'purpose' => 'any'
65 | ],
66 | '128x128' => [
67 | 'path' => '/images/icons/icon-128x128.png',
68 | 'purpose' => 'any'
69 | ],
70 | '144x144' => [
71 | 'path' => '/images/icons/icon-144x144.png',
72 | 'purpose' => 'any'
73 | ],
74 | '152x152' => [
75 | 'path' => '/images/icons/icon-152x152.png',
76 | 'purpose' => 'any'
77 | ],
78 | '192x192' => [
79 | 'path' => '/images/icons/icon-192x192.png',
80 | 'purpose' => 'any'
81 | ],
82 | '384x384' => [
83 | 'path' => '/images/icons/icon-384x384.png',
84 | 'purpose' => 'any'
85 | ],
86 | '512x512' => [
87 | 'path' => '/images/icons/icon-512x512.png',
88 | 'purpose' => 'any'
89 | ],
90 | ],
91 | 'splash' => [
92 | '640x1136' => '/images/icons/splash-640x1136.png',
93 | '750x1334' => '/images/icons/splash-750x1334.png',
94 | '828x1792' => '/images/icons/splash-828x1792.png',
95 | '1125x2436' => '/images/icons/splash-1125x2436.png',
96 | '1242x2208' => '/images/icons/splash-1242x2208.png',
97 | '1242x2688' => '/images/icons/splash-1242x2688.png',
98 | '1536x2048' => '/images/icons/splash-1536x2048.png',
99 | '1668x2224' => '/images/icons/splash-1668x2224.png',
100 | '1668x2388' => '/images/icons/splash-1668x2388.png',
101 | '2048x2732' => '/images/icons/splash-2048x2732.png',
102 | ],
103 | 'shortcuts' => [
104 | [
105 | 'name' => 'Shortcut Link 1',
106 | 'description' => 'Shortcut Link 1 Description',
107 | 'url' => '/shortcutlink1',
108 | 'icons' => [
109 | "src" => "/images/icons/icon-72x72.png",
110 | "purpose" => "any"
111 | ]
112 | ],
113 | [
114 | 'name' => 'Shortcut Link 2',
115 | 'description' => 'Shortcut Link 2 Description',
116 | 'url' => '/shortcutlink2'
117 | ]
118 | ],
119 | 'custom' => []
120 | ]
121 | ```
122 | You can specify the size of each icon as key of the array or specify it:
123 | ```
124 | [
125 | 'path' => '/images/icons/icon-512x512.png',
126 | 'sizes' => '512x512',
127 | 'purpose' => 'any'
128 | ],
129 |
130 | ```
131 | Obs: In the `custom` tag you can insert personalized tags to `manifest.json` like this e.g:
132 | ```php
133 | ...
134 | 'custom' => [
135 | 'tag_name' => 'tag_value',
136 | 'tag_name2' => 'tag_value2',
137 | ...
138 | ]
139 | ...
140 | ```
141 |
142 | Include within your `
` the blade directive `@laravelPWA`.
143 | ```html
144 |
145 |
146 | My Title
147 | ...
148 | @laravelPWA
149 |
150 |
151 | ...
152 | My content
153 | ...
154 |
155 |
156 | ```
157 |
158 |
159 | This should include the appropriate meta tags, the link to `manifest.json` and the serviceworker script.
160 |
161 | how this example:
162 | ```html
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
208 | ```
209 |
210 |
211 | Troubleshooting
212 | =====
213 | While running the Laravel test server:
214 |
215 | 1. Verify that `/manifest.json` is being served
216 | 1. Verify that `/serviceworker.js` is being served
217 | 1. Use the Application tab in the Chrome Developer Tools to verify the progressive web app is configured correctly.
218 | 1. Use the "Add to homescreen" link on the Application Tab to verify you can add the app successfully.
219 |
220 | The Service Worker
221 | =====
222 | By default, the service worker implemented by this app is:
223 | ```js
224 | var staticCacheName = "pwa-v" + new Date().getTime();
225 | var filesToCache = [
226 | '/offline',
227 | '/css/app.css',
228 | '/js/app.js',
229 | '/images/icons/icon-72x72.png',
230 | '/images/icons/icon-96x96.png',
231 | '/images/icons/icon-128x128.png',
232 | '/images/icons/icon-144x144.png',
233 | '/images/icons/icon-152x152.png',
234 | '/images/icons/icon-192x192.png',
235 | '/images/icons/icon-384x384.png',
236 | '/images/icons/icon-512x512.png',
237 | '/images/icons/splash-640x1136.png',
238 | '/images/icons/splash-750x1334.png',
239 | '/images/icons/splash-1242x2208.png',
240 | '/images/icons/splash-1125x2436.png',
241 | '/images/icons/splash-828x1792.png',
242 | '/images/icons/splash-1242x2688.png',
243 | '/images/icons/splash-1536x2048.png',
244 | '/images/icons/splash-1668x2224.png',
245 | '/images/icons/splash-1668x2388.png',
246 | '/images/icons/splash-2048x2732.png'
247 | ];
248 |
249 | // Cache on install
250 | self.addEventListener("install", event => {
251 | this.skipWaiting();
252 | event.waitUntil(
253 | caches.open(staticCacheName)
254 | .then(cache => {
255 | return cache.addAll(filesToCache);
256 | })
257 | )
258 | });
259 |
260 | // Clear cache on activate
261 | self.addEventListener('activate', event => {
262 | event.waitUntil(
263 | caches.keys().then(cacheNames => {
264 | return Promise.all(
265 | cacheNames
266 | .filter(cacheName => (cacheName.startsWith("pwa-")))
267 | .filter(cacheName => (cacheName !== staticCacheName))
268 | .map(cacheName => caches.delete(cacheName))
269 | );
270 | })
271 | );
272 | });
273 |
274 | // Serve from Cache
275 | self.addEventListener("fetch", event => {
276 | event.respondWith(
277 | caches.match(event.request)
278 | .then(response => {
279 | return response || fetch(event.request);
280 | })
281 | .catch(() => {
282 | return caches.match('offline');
283 | })
284 | )
285 | });
286 | ```
287 | To customize service worker functionality, update the `public_path/serviceworker.js`.
288 |
289 | The offline view
290 | =====
291 | By default, the offline view is implemented in `resources/views/vendor/laravelpwa/offline.blade.php`
292 |
293 | ```html
294 | @extends('layouts.app')
295 |
296 | @section('content')
297 |
298 | You are currently not connected to any networks.
299 |
300 | @endsection
301 | ```
302 | To customize update this file.
303 |
304 | ## Contributing
305 |
306 | Contributing is easy! Just fork the repo, make your changes then send a pull request on GitHub. If your PR is languishing in the queue and nothing seems to be happening, then send Silvio an [email](mailto:silviolleite@gmail.com).
307 |
--------------------------------------------------------------------------------
/Services/ManifestService.php:
--------------------------------------------------------------------------------
1 | config('laravelpwa.manifest.name'),
18 | 'short_name' => config('laravelpwa.manifest.short_name'),
19 | 'start_url' => asset(config('laravelpwa.manifest.start_url')),
20 | 'display' => config('laravelpwa.manifest.display'),
21 | 'theme_color' => config('laravelpwa.manifest.theme_color'),
22 | 'background_color' => config('laravelpwa.manifest.background_color'),
23 | 'orientation' => config('laravelpwa.manifest.orientation'),
24 | 'status_bar' => config('laravelpwa.manifest.status_bar'),
25 | 'splash' => config('laravelpwa.manifest.splash')
26 | ];
27 |
28 | foreach (config('laravelpwa.manifest.icons') as $size => $file) {
29 | $fileInfo = pathinfo($file['path']);
30 | $basicManifest['icons'][] = [
31 | 'src' => $file['path'],
32 | 'type' => 'image/' . $fileInfo['extension'],
33 | 'sizes' => (isset($file['sizes']))?$file['sizes']:$size,
34 | 'purpose' => $file['purpose']
35 | ];
36 | }
37 |
38 | if (config('laravelpwa.manifest.shortcuts')) {
39 | foreach (config('laravelpwa.manifest.shortcuts') as $shortcut) {
40 |
41 | if (array_key_exists("icons", $shortcut)) {
42 | $fileInfo = pathinfo($shortcut['icons']['src']);
43 | $icon = [
44 | 'src' => $shortcut['icons']['src'],
45 | 'type' => 'image/' . $fileInfo['extension'],
46 | 'sizes' => (isset($file['sizes']))?$file['sizes']:$size,
47 | 'purpose' => $shortcut['icons']['purpose']
48 | ];
49 | if(isset($shortcut['icons']['sizes'])) {
50 | $icon["sizes"] = $shortcut['icons']['sizes'];
51 | }
52 | } else {
53 | $icon = [];
54 | }
55 |
56 | $basicManifest['shortcuts'][] = [
57 | 'name' => trans($shortcut['name']),
58 | 'description' => trans($shortcut['description']),
59 | 'url' => $shortcut['url'],
60 | 'icons' => [
61 | $icon
62 | ]
63 | ];
64 | }
65 | }
66 |
67 | foreach (config('laravelpwa.manifest.custom') as $tag => $value) {
68 | $basicManifest[$tag] = $value;
69 | }
70 | return $basicManifest;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/Services/MetaService.php:
--------------------------------------------------------------------------------
1 | generate(); echo \$__env->make( 'laravelpwa::meta' , ['config' => \$config])->render(); ?>";
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/Tests/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/Tests/.gitkeep
--------------------------------------------------------------------------------
/assets/images/icons/icon-128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-128x128.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-144x144.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-152x152.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-192x192.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-384x384.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-384x384.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-512x512.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-72x72.png
--------------------------------------------------------------------------------
/assets/images/icons/icon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/icon-96x96.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1125x2436.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1125x2436.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1242x2208.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1242x2208.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1242x2688.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1242x2688.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1536x2048.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1536x2048.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1668x2224.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1668x2224.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-1668x2388.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-1668x2388.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-2048x2732.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-2048x2732.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-640x1136.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-640x1136.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-750x1334.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-750x1334.png
--------------------------------------------------------------------------------
/assets/images/icons/splash-828x1792.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/assets/images/icons/splash-828x1792.png
--------------------------------------------------------------------------------
/assets/js/serviceworker.js:
--------------------------------------------------------------------------------
1 | var staticCacheName = "pwa-v" + new Date().getTime();
2 | var filesToCache = [
3 | '/offline',
4 | '/css/app.css',
5 | '/js/app.js',
6 | '/images/icons/icon-72x72.png',
7 | '/images/icons/icon-96x96.png',
8 | '/images/icons/icon-128x128.png',
9 | '/images/icons/icon-144x144.png',
10 | '/images/icons/icon-152x152.png',
11 | '/images/icons/icon-192x192.png',
12 | '/images/icons/icon-384x384.png',
13 | '/images/icons/icon-512x512.png',
14 | ];
15 |
16 | // Cache on install
17 | self.addEventListener("install", event => {
18 | this.skipWaiting();
19 | event.waitUntil(
20 | caches.open(staticCacheName)
21 | .then(cache => {
22 | return cache.addAll(filesToCache);
23 | })
24 | )
25 | });
26 |
27 | // Clear cache on activate
28 | self.addEventListener('activate', event => {
29 | event.waitUntil(
30 | caches.keys().then(cacheNames => {
31 | return Promise.all(
32 | cacheNames
33 | .filter(cacheName => (cacheName.startsWith("pwa-")))
34 | .filter(cacheName => (cacheName !== staticCacheName))
35 | .map(cacheName => caches.delete(cacheName))
36 | );
37 | })
38 | );
39 | });
40 |
41 | // Serve from Cache
42 | self.addEventListener("fetch", event => {
43 | event.respondWith(
44 | caches.match(event.request)
45 | .then(response => {
46 | return response || fetch(event.request);
47 | })
48 | .catch(() => {
49 | return caches.match('offline');
50 | })
51 | )
52 | });
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "silviolleite/laravelpwa",
3 | "description": "Looks like an app, feels like an app, but NOT an app.",
4 | "license": "MIT",
5 | "keywords": [
6 | "laravel",
7 | "php",
8 | "pwa",
9 | "progressive web apps"
10 | ],
11 | "authors": [
12 | {
13 | "name": "Silvio Luis Leite",
14 | "email": "silviolleite@gmail.com"
15 | }
16 | ],
17 | "autoload": {
18 | "psr-4": {
19 | "LaravelPWA\\": ""
20 | }
21 | },
22 | "minimum-stability": "stable",
23 | "extra": {
24 | "laravel": {
25 | "providers": [
26 | "LaravelPWA\\Providers\\LaravelPWAServiceProvider"
27 | ]
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/database/seeders/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/silviolleite/laravel-pwa/f52e9235e901e9ee015f56e94ec0c178bd5b2f75/database/seeders/.gitkeep
--------------------------------------------------------------------------------
/module.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "LaravelPWA",
3 | "alias": "laravelpwa",
4 | "description": "Looks like an app, feels like an app, but NOT an app.",
5 | "keywords": ["laravel", "pwa", "progressive web app"],
6 | "active": 1,
7 | "order": 0,
8 | "providers": [
9 | "LaravelPWA\\Providers\\LaravelPWAServiceProvider"
10 | ],
11 | "aliases":{},
12 | "files": [
13 | "start.php"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/resources/views/meta.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/resources/views/offline.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 | You are currently not connected to any networks.
6 |
7 | @endsection
--------------------------------------------------------------------------------
/start.php:
--------------------------------------------------------------------------------
1 |