Download the PHP package zhartaunik-fork/magento2-serviceworker without Composer

On this page you can find all versions of the php package zhartaunik-fork/magento2-serviceworker. 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 magento2-serviceworker

Meanbee_ServiceWorker

A Magento 2 extension that adds Service Worker support.

Features:

Installation

Add this extension to your Magento installation with Composer:

composer require meanbee/magento2-serviceworker

Usage

Configuration

The Service Worker is configured and enabled by default. However, Service Workers require the site to run on HTTPS.

Features can be customised in Stores > Configuration > General > Web > Service Worker Settings.

Adding more logic

If the base service worker file doesn't fit all of your needs you can easily add more logic using the layout system, targeting the serviceworker_index_js handle:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="serviceworker">
            <block class="\Meanbee\MoreLogic\Block\Logic" name="morelogic.logic" template="Meanbee_MoreLogic::logic.phtml" />
        </referenceBlock>
    </body>
</page>

FAQ

Why do page assets not appear to be cached when Magento is in default/developer mode?

Magento 2 uses a timestamp version string in the URL for static files to allow busting browser cache when the static content gets updated. In developer mode, this version string is updated for every unique page request. This means that from the browser's perspective, the static assets, such as CSS files, are completely different on each page, even though the content is the same. Therefore, when the assets get cached by the Service Worker in Magento 2 developer mode, they only get cached for that specific page. Production mode only generates the static assets through command line and keeps the version timestamp fixed, so it doesn't experience this issue.

Development

Setting up a development environment

A Docker development environment is included with the project:

docker-compose run --rm cli magento-extension-installer Meanbee_ServiceWorker \
&& docker-compose up -d

npm dependencies

The extension uses npm to manage some of its web dependencies. Dependencies are installed and updated using npm, then copied into the src/ directory using an npm script. To update the web dependencies, run:

docker-compose run --rm node npm update
docker-compose run --rm node npm run build

Testing Service Workers on Chrome

Chrome is very strict about security and only allows Service Workers on localhost, or on an HTTPS site with a valid certificate. To bypass these restrictions for testing, use the --ignore-certificate-errors and --unsafely-treat-insecure-origin-as-secure flags to run a less secure copy of Chrome:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
    --user-data-dir=/tmp/chrome \
    --ignore-certificate-errors \
    --unsafely-treat-insecure-origin-as-secure=https://m2-meanbee-serviceworker.docker/

All versions of magento2-serviceworker with dependencies

PHP Build Version
Package Version
Requires magento/framework Version *
magento/module-backend Version *
magento/module-config Version *
magento/module-cms Version *
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 zhartaunik-fork/magento2-serviceworker contains the following files

Loading the files please wait ....