简体   繁体   中英

Convert Laravel into PWA

I want to convert my laravel application (e-commerce store) into a progressive web application (pwa). How do I do that? Does it need a complete SPA in vue or it can be done using blade template engine (blade view files)? What is the proper way to do it ?

It really depends on what's the current state of your application, however you can start one step at the time with making your web a PWA.

Couple of things you need are:

  1. SSL certificate, because the service worker

Using service worker you can hijack connections, fabricate, and filter responses. Powerful stuff. While you would use these powers for good, a man-in-the-middle might not. To avoid this, you can only register service workers on pages served over HTTPS, so we know the service worker the browser receives hasn't been tampered with during its journey through the network.

Don't required on your local while you are developing stuff.

  1. A service worker you can read more about this on the link.

For the service worker there a few options out there to help you getting started with different caching strategies for sections of your page.

A great example of this is: https://developers.google.com/web/tools/workbox/

You have a full list detailed here with the full list of things you need to cover.

Another thing is with PWA it does not have to be all your site to work online working iteratively it's great as you can start with a simple page to show a message when you don't have connection to the internet and after that start adding more features.

As mentioned above Google has a great list of resources for this at:

In the context of Laravel as long as your views are rendered (blade) you can cache the responses or specific content with the service worker.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM