Download the PHP package brocode/module-web-share without Composer

On this page you can find all versions of the php package brocode/module-web-share. 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 module-web-share

BroCode_WebShare

A Share button for Magento 2 product pages, category pages, product lists and CMS pages. On phones, tablets and most desktop browsers it opens the device's own share sheet (WhatsApp, Messages, AirDrop, Mail, …) through the browser's Web Share API. Where the browser has no share sheet, it opens a small panel of share links instead, configured in the admin. No third-party scripts, no tracking pixels, no extra CSP entries.

Module page: brocode.at/modules/module-web-share/

In production mode, also run setup:di:compile and setup:static-content:deploy as usual.

What it does

Configuration

Stores > Configuration > Catalog > Catalog > Web Share. Every setting can differ per website and store view — untick Use Default on the store view to override it there.

Setting Default
Enabled Yes
Show on Product Pages Yes
Show on Category Pages Yes
Show on Product Lists Yes (one icon per product tile)
Offer "Copy Link" in the Fallback Yes (shown only where the Clipboard API is available)
Share Text {{title}}
Fallback Share Links WhatsApp, Facebook, X, LinkedIn, Pinterest, Email

Share text

A sentence sent along with the link, for example Found this at our shop: {{title}} — set it per store view to translate it. {{title}} becomes the product, category or page title. The native share sheet receives it as its text, and the share links can use it as {{text}}. Facebook and LinkedIn ignore both: they only take the URL and build the preview from the page's Open Graph tags (Luma's product pages have them; stock category and CMS pages do not, so their previews are thinner).

Share links

Each row has a Label, a URL Template and an Active switch. Set Active to No to hide a network without losing its template; delete a row to remove it for good. Rows appear in the order they are listed. The placeholders are URL-encoded on output:

Placeholder Product page / tile Category CMS widget
{{url}} product URL category URL page URL without query string
{{title}} product name category name page title
{{text}} the share text the share text the share text
{{image}} main image (on tiles: the grid image already generated for the tile) category image, if set empty

Only https:, http: and mailto: templates are rendered — the templates end up in href attributes, so anything else (javascript:, data:, relative paths) is dropped instead of output.

The defaults, and how sure each one is:

Network Template Source
WhatsApp https://wa.me/?text={{text}}%20{{url}} WhatsApp click-to-chat (wa.me, text parameter)
Facebook https://www.facebook.com/sharer/sharer.php?u={{url}} Not in Meta's current docs (they document the Share Dialog, which needs an app ID); long-standing and working. Only the URL is used.
X https://x.com/intent/tweet?text={{text}}&url={{url}} X web intent docs
LinkedIn https://www.linkedin.com/sharing/share-offsite/?url={{url}} Not documented (LinkedIn documents a JavaScript plugin only); the de facto standard link. Only the URL is used.
Pinterest https://www.pinterest.com/pin/create/button/?url={{url}}&media={{image}}&description={{text}} Pinterest save button docs
Email mailto:?subject={{title}}&body={{text}}%0A%0A{{url}} mailto: (RFC 6068)

All six were checked in a browser on 2026-09-26: each keeps the product URL through its redirect or login page. Facebook, X and LinkedIn need a logged-in account to show the prefilled dialog.

Adding another network

Add a row with the network's share URL and the placeholders. Telegram, for example, as documented by Telegram:

Label URL Template
Telegram https://t.me/share/url?url={{url}}&text={{text}}

Configuring it at deploy time

Everything above is ordinary store configuration, so it can be set from the command line or pinned in app/etc/config.php / env.php like any other setting. The share links are stored as JSON:

Add --lock-config to write the value to app/etc/config.php (shared across environments) or --lock-env for app/etc/env.php; a locked value is shown read-only in the admin.

When app/etc/config.php changes any other way — a deploy, a git pull, a file copied back — run bin/magento app:config:import (setup:upgrade does it too). Until then Magento answers every storefront request with The configuration file has changed.

For CMS pages and blocks, insert the widget Web Share Button.

Hooks for analytics and themes

Every share fires a webshare:share event on document:

The markup uses .brocode-web-share, .brocode-web-share-toggle and .brocode-web-share-links; the panel is only positioned as a dropdown once JavaScript has added .is-enhanced, and opens to the left (.is-flipped) when it would leave the viewport.

Requirements and limits

License

MIT, see LICENSE.

If this saves you time: buy me a coffee.


All versions of module-web-share with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0||~8.2.0||~8.3.0||~8.4.0
magento/framework Version >=103.0.0
magento/module-catalog Version >=104.0.0
magento/module-catalog-search Version >=102.0.0
magento/module-config Version >=101.2.0
magento/module-store Version >=101.0.0
magento/module-widget Version >=101.0.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 brocode/module-web-share contains the following files

Loading the files please wait ...