PHP code example of zmrq / php-pwa

1. Go to this page and download the library: Download zmrq/php-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/ */

    

zmrq / php-pwa example snippets


    
        use Zmrq\PWA\Pwa;

        // The 'dir' parameter is the public root directory for PWA assets, default is 'pwa'.
        Pwa::enable(dir: 'pwa');

        // This returns an instance of the manifest class, allowing you to configure the manifest.
        $manifest = Pwa::enable(dir: 'pwa')
                        ->name('PHP PWA')
                        ->shortName('PWA')
                        ->startUrl('/');
    

        <?= Pwa::renderMetaTags()
    


        <?= Pwa::renderServiceWorker() 
bash
composer 

/public
    /pwa
        ├── logo.png
        ├── offline.html
        ├── manifest.json
        └── sw.js
    ├── index.php