Download the PHP package mage2kishan/module-corewebvitals without Composer

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

Magento 2 Core Web Vitals

Panth_CoreWebVitals collects Core Web Vitals (LCP, FID, INP and CLS) from real visitors of a Magento 2 storefront. When the module is enabled it renders an inline JavaScript snippet on every frontend page that registers PerformanceObserver listeners in the browser, rates each collected value, and optionally forwards the values to Google Analytics 4 and to a custom beacon endpoint. It also lets the administrator output resource hint link tags (dns-prefetch, preconnect, prefetch) and adds performance related HTTP headers (Server-Timing, X-DNS-Prefetch-Control, Link) to the response.

The module is aimed at merchants and developers who want field measurements of their store's Core Web Vitals without adding a third party library. It uses the standard head.additional block and before.body.end container and contains no theme specific code, so it works on both Hyva and Luma themes.

Product page: kishansavaliya.com/magento-2-corewebvitals.html

Features

Compatibility

Platform Versions
Magento Open Source 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 (as published on the product page)
Adobe Commerce 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 (as published on the product page)
PHP 8.1, 8.2, 8.3, 8.4 (~8.1.0||~8.2.0||~8.3.0||~8.4.0 in composer.json)
Themes Hyva and Luma

Composer constraints on Magento packages: magento/framework ^103.0, magento/module-store ^101.0, magento/module-config ^101.0, magento/module-backend ^102.0.

Requirements

Installation

setup:di:compile is only needed when Magento runs in production mode. The module ships no files under view/*/web, so setup:static-content:deploy is not required for it.

Check that the module is active:

Configuration

Admin path: Stores > Configuration > Panth Extensions > Core Web Vitals (section id panth_corewebvitals). All fields can be set at default, website and store view scope. The module is disabled by default; nothing is rendered and no headers are added until "Enable Module" is set to Yes.

General Settings

Setting Default What it does
Enable Module No Master switch. Renders the monitoring snippet on frontend pages and activates the resource hints and response headers. All other fields depend on it.
Debug Mode No Logs collected metrics to the browser console and exposes window.coreWebVitalsMetrics.
Send Metrics to Analytics Yes Sends collected metrics to GA4 (when gtag exists on the page) and to the beacon endpoint below.
Custom Beacon Endpoint URL (blank) Absolute URL that receives a JSON POST through navigator.sendBeacon with the final value of each metric when the page is hidden or left. Blank skips the beacon. Shown only when "Send Metrics to Analytics" is Yes.
GA4 Measurement ID (blank) Optional G-XXXXXXX value used as the send_to parameter of the gtag() call. Shown only when "Send Metrics to Analytics" is Yes.

Config paths: panth_corewebvitals/general/enabled, panth_corewebvitals/general/debug_mode, panth_corewebvitals/general/real_user_monitoring, panth_corewebvitals/general/endpoint_url, panth_corewebvitals/general/ga4_measurement_id.

LCP (Largest Contentful Paint) Monitoring

Setting Default What it does
Monitor LCP Yes Registers the largest-contentful-paint observer.
Target LCP (milliseconds) 2500 Upper bound for a "good" LCP rating. Values above it and up to 4000 ms (or up to the target, if higher) are rated "needs-improvement"; anything slower is "poor".

Config paths: panth_corewebvitals/lcp/enabled, panth_corewebvitals/lcp/target_lcp.

FID / INP (Interaction Responsiveness) Monitoring

Setting Default What it does
Monitor FID and INP Yes Registers the first-input and event observers.
Target FID (milliseconds) 100 Upper bound for a "good" FID rating. The "poor" boundary stays at 300 ms unless the target is higher.
Target INP (milliseconds) 200 Upper bound for a "good" INP rating. The "poor" boundary stays at 500 ms unless the target is higher.

Config paths: panth_corewebvitals/fid/enabled, panth_corewebvitals/fid/target_fid, panth_corewebvitals/fid/target_inp.

CLS (Cumulative Layout Shift) Monitoring

Setting Default What it does
Monitor CLS Yes Registers the layout-shift observer.
Target CLS Score 0.1 Upper bound for a "good" CLS rating. The "poor" boundary stays at 0.25 unless the target is higher.

Config paths: panth_corewebvitals/cls/enabled, panth_corewebvitals/cls/target_cls.

Resource Hints

Setting Default What it does
DNS Prefetch Domains (blank) One domain per line without protocol. Each line becomes <link rel="dns-prefetch" href="//domain">; a line that already starts with http://, https:// or // is used as is. Also turns on the X-DNS-Prefetch-Control: on response header.
Preconnect Domains (blank) One domain per line without protocol. Each line is reduced to its origin (https:// is added when no scheme is given, paths are dropped, duplicates and invalid lines are skipped) and becomes <link rel="preconnect" href="https://domain" crossorigin> plus a Link: <https://domain>; rel=preconnect; crossorigin response header.
Prefetch URLs (blank) One full URL per line. Each line becomes <link rel="prefetch" href="url">.

Config paths: panth_corewebvitals/resource_hints/dns_prefetch, panth_corewebvitals/resource_hints/preconnect, panth_corewebvitals/resource_hints/prefetch.

Blank lines and surrounding whitespace in the textarea fields are ignored.

Usage

Page output. With the module enabled, the frontend default.xml layout adds two blocks:

Metric collection. Each metric is reported with a name (LCP, FID, INP, CLS), a numeric value (milliseconds, or a unitless score for CLS), a rating, an id, a delta and the observed entries. Values are rated against the thresholds published for Core Web Vitals (see web.dev), with the "good" boundary of each metric replaced by the configured target.

Reporting. When "Send Metrics to Analytics" is Yes:

In addition, every metric dispatches window.dispatchEvent(new CustomEvent('coreWebVitals:<metric>', { detail })), so other scripts can listen with, for example, window.addEventListener('coreWebVitals:lcp', function (e) { console.log(e.detail); }).

Response headers. The plugin Plugin\AddPerformanceHeaders runs before Magento\Framework\App\Response\Http::sendResponse() and, when the module is enabled, sets:

The plugin is declared in etc/frontend/di.xml, so it only applies to storefront responses, not to the admin, REST, SOAP or GraphQL areas.

The module has no admin report pages, no scheduled cron jobs and no console commands. Collected metrics are not stored in Magento; they only exist in the browser and in whatever analytics destination is configured.

Developer Notes

Uninstallation

No database tables are created by the module, so nothing needs to be dropped. Saved configuration values under panth_corewebvitals/* remain in core_config_data and can be deleted manually if wanted. Remove Panth_Core only if no other Panth module depends on it.

Support

Documentation

USER_GUIDE.md is written for store administrators and covers installation, verifying that the module is active, every configuration field, what each metric means, resource hints, the performance HTTP headers, integrating with GA4 or a custom endpoint, and troubleshooting.

License

Commercial software license. See LICENSE.txt in this repository.

Changelog

See CHANGELOG.md.

Links


All versions of module-corewebvitals 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
magento/module-store Version ^101.0
magento/module-config Version ^101.0
magento/module-backend Version ^102.0
mage2kishan/module-core Version ^1.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 mage2kishan/module-corewebvitals contains the following files

Loading the files please wait ...