Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Progressive Web Apps for PHP Developers

Femi TAIWO
January 12, 2017

Progressive Web Apps for PHP Developers

So we may have heard quite a bit about Progressive Web Apps (or not), making your sites work offline and load really fast. A question often asked is - "I have this app built w/o this awesome PHP Framework, where do I begin?"
During this talk, Femi will be taking us through a step by step process for making a platform with a PHP backend a progressive web app, backed with examples of where this has been done.

Femi TAIWO

January 12, 2017
Tweet

More Decks by Femi TAIWO

Other Decks in Technology

Transcript

  1. What we’ll cover 1. What’s a Progressive Web App? 2.

    Key Features of PWAs 3. Sites that are PWAs 4. Getting Started with PWAs 5. Work Offline, Be Installable, Send Pushes 6. Resources, People & Credits
  2. 80% OF TIME SPENT IS IN USERS’ TOP 3 APPS

    Source: comScore Mobile Metrix, U.S., Age 18+, June 2015
  3. Progressive Web App A web application that - takes advantage

    of modern browser features, - can be added to your homescreen, - behaves like a native application, - has features such as push messaging, - supports offline mode.
  4. “ Progressive Web Apps are a whole new level of

    caring about the quality of your end-to-end user experience
  5. 1. Loads Instantly 2. Installable 3. Push Messaging 4. App-Like

    5. Responsive 6. Secure 7. Discoverable 8. Shareable Key Features of PWAs
  6. With Service Workers ◇ Prefetch App Resources ◇ Work Offline

    ◇ Sync in the Background ◇ Show Push Notifications ◇ Control Network Requests ◇ Move fast after first visit
  7. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/service-worker.js') .then(function(reg) { console.log('Service Worker

    Registered', reg); }) .catch(function(err) { console.log('Error registering Service Worker', err); }); } https://developers.google.com/web/fundamentals/primers/service-worker/?hl=en
  8. var CACHE_NAME = 'my-site-cache-v1'; var urlsToCache = [ '/', '/styles/main.css',

    '/script/main.js' ]; self.addEventListener('install', function(event) { // Perform install steps event.waitUntil( caches.open(CACHE_NAME) .then(function(cache) { console.log('Opened cache'); return cache.addAll(urlsToCache); }) ); });
  9. <link rel="manifest" href="/manifest.json"> { "name": "DealHunter Demo", "short_name": "DealHunter", "icons":

    [{ "src": "icon-48x48.png", "sizes": "48x48", "type": "image/png" }, {...}], "start_url": "/", "display": "standalone", "orientation": "portrait", "background_color": "#000000", "theme_color": "#000000" }
  10. • Web Bluetooth • Web NFC • Generic Sensor API

    • More! Roadmap | Emerging Standards
  11. • Showcase: https://pwa.rocks/ • Browser Status: https://jakearchibald.github.io/isserviceworkerready/ • Lighthouse -

    https://github.com/GoogleChrome/lighthouse • Washington Post PWA - https://wapo.com/pwa • Let’s Encrypt - https://letsencrypt.org/ • SSLMate - https://sslmate.com • Search Ranking Guidance - https://bit.ly/https-migration • Offline cookbook - https://jakearchibald.com/2014/offline-cookbook/ • Code labs - https://codelabs.developers.google.com/pwa-roadshow • Retention: http://blog.gaborcselle.com/2012/10/every-step-costs-you-20-of-users.html Resources
  12. Credits Special thanks to all the people who made and

    released these awesome resources for free: ◇ Presentation template by SlidesCarnival ◇ Photographs by Unsplash