Download the PHP package heimrichhannot/contao-pwa-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-pwa-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package contao-pwa-bundle

Contao Progressive Web App Bundle

A bundle to provide progressive web app support for contao.

This bundle is still in beta. Please provide feedback if you use it!

This bundle is using PHP Web Push lib to provide push notifications.

Features

Setup

Requirements

For web push notifications:

Install

  1. Install via composer or contao manager

    composer require heimrichhannot/contao-pwa-bundle
  2. Update your database

First Steps

  1. Your page template (typically fe_page.html5) must support Head Bundle. This means it must output at least $this->meta() in head section. See Head Bundle readme for more information
  2. If you want to use push notifications, add vapid keys to your config (see Setup -> Vapidkeys)
  3. Create an PWA Configuration(Backend -> System -> PWA Configuration)
  4. Add the configuration to a page root (in page settings you find a new section "Progressive Web App", select yes and choose your configuration)
    • On saving the page the page manifest and the serviceworker will be generated
  5. To provide an option to register to your push notifications, add the Push Subscription Button content element or the push notification popup frontend module to your page.

Push Notifications

VAPID keys

You need to add your server vapid keys to your config file, typical in your project config.yml. If you haven't already vapid keys, you can generate in the PWA Bundle backend (Contao Backend -> System -> PWA Configuration -> Control -> Authentication)

Usage

Regenerate files

You can regenerate all your manifest and service worker files at once from the Pwa Control (Contao Backend -> System -> PWA Configuration -> Control -> Files -> Rebuild files)

There is also an command available: huh:pwa:build

Developers

JS Event

To support custom controls, there are events and event listeners that can be used. All events are dispatched and listen to on document.

Events

Event Description
huh_pwa_sw_not_supported Fired if browser not supports serviceworker or no service worker found.
huh_pwa_push_not_supported Fired if browser not supports push notifications
huh_pwa_push_permission_denied Fired if browser has push notifications blocked
huh_pwa_push_isSubscribed Fired when subscribed to push notifications (on page load or when subscribe)
huh_pwa_push_isUnsubscribed Fired when unsubscribed from push notification (on page load or when unsubscribe)
huh_pwa_push_subscription_failed Fired when subscription to push notifications failed. Error reason can be found in event.detail.reason.
huh_pwa_push_unsubscription_failed Fired when unsubscribe from push notifications failed. Error reason can be found in event.detail.reason.

Listener

Event type Usage Description
huh_pwa_push_changeSubscriptionState new CustomEvent( 'huh_pwa_push_changeSubscriptionState', {detail: ['subscribe'\|'unsubscribe']} ) Fire this event when the user interacts with your control to change his subscription state. Use a CustomEvent with detail parameter set to subscribe or unsubscrive.

Complete configuration

Commands

Command Description
huh:pwa:build (Re)Build config specific files like service worker and manifest
huh:pwa:sendpush Send unsent push notifications

Add additional head scripts

It is possible to add additional js code to the head section by using the PwaHeadScriptTags object available available as huh.head.tag.pwa.script service. Code added with addScript will be outputted in header section of your page within <script type='text/javascript'> tags.

Polyfills

Funtion Example Polyfill Description
CustomEvent custom-event-polyfill Custom events are needed to update the subscribe button (to inform the user that the browser not supporting push notifications). Also an error is thrown if the browser not supporting CustomEvents.

Todo


All versions of contao-pwa-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
ext-fileinfo Version *
contao/core-bundle Version ^4.9
heimrichhannot/contao-encore-contracts Version ^1.0.2
heimrichhannot/contao-head-bundle Version ^1.2
heimrichhannot/contao-utils-bundle Version ^2.215
heimrichhannot/contao-twig-support-bundle Version ^0.2.16|^1.0
menatwork/contao-multicolumnwizard Version ^3.3
symfony/framework-bundle Version ^4.4 || ^5.4
symfony/string Version ^5.4 || ^6.0
symfony/translation-contracts Version ^1.0 || ^2.0 || ^3.0
twig/twig Version ^1.44 || ^2.14 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package heimrichhannot/contao-pwa-bundle contains the following files

Loading the files please wait ....