PHPackages                             elgentos/module-lightspeed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. elgentos/module-lightspeed

ActiveMagento2-module[Framework](/categories/framework)

elgentos/module-lightspeed
==========================

Magento 2 Lightspeed optimizations

1.0.3(1y ago)6239.0k↓39.1%14[1 issues](https://github.com/elgentos/magento2-lightspeed/issues)UnlicensePHPPHP &gt;=7.2

Since Feb 6Pushed 1y ago14 watchersCompare

[ Source](https://github.com/elgentos/magento2-lightspeed)[ Packagist](https://packagist.org/packages/elgentos/module-lightspeed)[ RSS](/packages/elgentos-module-lightspeed/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Magento 2 - Lightspeed for Lighthouse optimizations
===================================================

[](#magento-2---lightspeed-for-lighthouse-optimizations)

Process your Google Lighthouse feedback using sane defaults. This module defines several sections where you can define common feedback from Google Lighthouse.

Installation
------------

[](#installation)

Run this in your Magento 2 project root;

```
composer require elgentos/module-lightspeed
php bin/magento module:enable Elgentos_Lightspeed
php bin/magento setup:upgrade
```

Features
--------

[](#features)

### Javascript handling

[](#javascript-handling)

Move all `script` tags before body end. This is the default after installing this module, no exceptions.

### Connection optimization (layout.xml)

[](#connection-optimization-layoutxml)

Allow modern browsers to use DNS prefetching and preconnecting.

DNS prefetching only does a DNS lookup, preconnecting already connects to the remote server and does SSL handshake. Preconnecting is limited to a few connections which is defined in your browser, we have fallback to DNS-prefetching, but think before you add everything to `preconnect`.

### Fonts (layout.xml)

[](#fonts-layoutxml)

Load external fonts to the head section.

### Styles (layout.xml)

[](#styles-layoutxml)

Inline CSS in the head or before body end for critical CSS.

### External CSS (layout.xml)

[](#external-css-layoutxml)

We have several options for optimizing external CSS;

- Directly in the head;
- Before body end;
- Defer till all other stuff is done.

### Javascript (layout.xml)

[](#javascript-layoutxml)

Javascript via XML before body end via layout XML.

Usage
-----

[](#usage)

Preferred usage to keep everything together is to add a handle to `layout/default.xml`. You can also add controller specific rules, add them in the controller specific handles, for instance `layout/catalog_category_default.xml`

You can also add specific rules and bind them to your module, instead to the theme.

`app/design/frontend/your/theme/Magento_Theme/layout/default.xml`

```

```

After that all default lighthouse feedback can go into `layout/default_lightspeed.xml`

`app/design/frontend/your/theme/Magento_Theme/layout/default_lightspeed.xml`

```

                    www.google.com
                    www.gstatic.com
                    www.googleadservices.com

                    fonts.googleapis.com
                    fonts.gstatic.com

                    www.googletagmanager.com

                https://fonts.googleapis.com/css?family=Font&amp;amp;display=swap

                *{color: red !important;}]]>

                *{color: red !important;}]]>

```

Block quick references
----------------------

[](#block-quick-references)

### References HEAD

[](#references-head)

- `lightspeed.head.dns-prefetch`
- `lightspeed.head.preconnect`
- `lightspeed.head.fonts`
- `lightspeed.head.inline-styles`

### References (before body end)

[](#references-before-body-end)

- `lightspeed.body.defer-styles`
- `lightspeed.body.no-defer-styles`
- `lightspeed.body.inline-styles`
- `lightspeed.body.footer-js`

Block code reference
--------------------

[](#block-code-reference)

You can also use `\Elgentos\Lightspeed\Block\ItemsWithPattern` to add your own references.

Public:

- `addItem(string $value): void`
- `addItems(array $values): void`
- `getItems(): array`
- `hasItems(): bool`
- `removeItem(string $value): void`
- `setPattern(string $pattern): void`
- `render(): string`

### Custom block definition

[](#custom-block-definition)

`default.xml`

```

               ]]>

```

Authors
-------

[](#authors)

- [Gideon Overeem](@govereem)
- [Jeroen Boersma](@Jeroen_Boersma)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance48

Moderate activity, may be stable

Popularity42

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~959 days

Total

3

Last Release

375d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88a6d8dc588e8f2a0948335563a754687f71304f0bd3b7f7049d4bcdc00a563c?d=identicon)[peterjaap](/maintainers/peterjaap)

---

Top Contributors

[![JeroenBoersma](https://avatars.githubusercontent.com/u/1163348?v=4)](https://github.com/JeroenBoersma "JeroenBoersma (10 commits)")[![peterjaap](https://avatars.githubusercontent.com/u/431360?v=4)](https://github.com/peterjaap "peterjaap (4 commits)")[![itris](https://avatars.githubusercontent.com/u/2884813?v=4)](https://github.com/itris "itris (1 commits)")

### Embed Badge

![Health badge](/badges/elgentos-module-lightspeed/health.svg)

```
[![Health](https://phpackages.com/badges/elgentos-module-lightspeed/health.svg)](https://phpackages.com/packages/elgentos-module-lightspeed)
```

###  Alternatives

[magewirephp/magewire

A framework that makes building reactive and dynamic interfaces simple in Magento 2

2561.2M31](/packages/magewirephp-magewire)[hyva-themes/magento2-react-checkout

Highly customizable Magento 2 Checkout, built with React

189169.8k1](/packages/hyva-themes-magento2-react-checkout)[umc/module-crud

Magento 2 module for reducing the CRUD boilerplate

269.3k1](/packages/umc-module-crud)[mage2pro/core

Mage2.PRO core package.

1141.1k126](/packages/mage2pro-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
