# yireo/magento2-linkpreload

> Magento 2 extension to set HTTP Link headers for primary resources to allow for HTTP/2 preloading

`composer require yireo/magento2-linkpreload`

Canonical URL: https://packagento.com/yireo/magento2-linkpreload

## At a glance

- **Vendor**: yireo (https://packagento.com/yireo.md)
- **Latest version**: 1.4.25 — released 2026-05-19
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/yireo/magento2-linkpreload and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require yireo/magento2-linkpreload:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento 2 extension to set HTTP Link headers for primary resources to allow for HTTP/2 preloading

## README

Magento 2 extension to set HTTP Link headers for primary resources to allow for HTTP/2 preloading.

Note: This module was formally known as `Yireo_ServerPush` but the name gave a wrong impression (referring to the HTTP/2 `PUSH` feature). Hence this module was renamed.

### See also:
- [Installation](INSTALL.md)
- [Usage](USAGE.md)
- [Notes](NOTES.md)

## Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [Unreleased]

### [1.4.25] - 19 May 2026
#### Fixed
- Allow removing stylesheets from preload
- Do not load preload deferred scripts or links with fetchpriority!=high

### [1.4.24] - 09 September 2025
#### Fixed
- Wrap Crawler in exception to prevent warning

### [1.4.23] - 09 September 2025
#### Fixed
- Check for symfony/dom-crawler 7.4 as thats the first version that uses PHP 8.4 parser.
- Only use HTML5 based parser when PHP >= 8.4
- Increase Symfony deps
- Fix PHPStan issues

### [1.4.22] - 4 March 2024
#### Fixed
- Fix Link HTTP headers to be in right format
- Add various integration tests (HTML body, FPC)
- Remove unneeded module version

### [1.4.21] - 26 May 2023
#### Fixed
- Fix stringing of content (@MaximGns, #43)

### [1.4.20] - 10 May 2023
#### Fixed
- Add compatibility with Symfony 6

### [1.4.19] - 5 October 2022
#### Fixed
- Added nopush to all preload links

### [1.4.18] - 26 June 2022
#### Fixed
- Loosen symfony/dom-crawler constraint #40 (@bramstroker)

### [1.4.17] - 18 June 2022
#### Fixed
- Only preload CSS when critical CSS is disabled (@Quazz)

### [1.4.16] - 5 April 2022
#### Fixed
- Prevent LinkPreload module on non-HTML content

### [1.4.15] - 31 March 2022
#### Fixed
- Don't preload lazy loading images #36 (@Quazz)

### [1.4.14] - 20 February 2022
#### Fixed
- Missing crossorigin in html output (@mageho)

### [1.4.13] - 19 January 2022
#### Fixed
- Make sure title is only parsed once, fixing issues with SVGs

### [1.4.12] - 8 July 2021
#### Fixed
- Fix PHP Fatal Error with preconfigured assets from layout

### [1.4.11] - 7 July 2021
#### Fixed
- Prevent multiple rel-attributes
- Complete refactoring to cleanup code

### [1.4.10] - 15 June 2021
#### Fixed
- Forget to include XML file

### [1.4.9] - 15 June 2021
#### Added
- Added `hyva_default` XML layout handle for Hyva compatibility

### [1.4.8] - 12 January 2021
#### Fixed
- Cast response to string #26 (@barryvdh)

### [1.4.7] - 7 January 2021
#### Added
- Add preload-attributes to HTML as well

### [1.4.6] - 29 July 2020
#### Added
- Magento 2.4 support

### [1.4.5] - 2020-07-20
#### Added
- Increase dep with symfony/css-selector

### [1.4.4] - 2020-06-12
#### Added
- Construct link according to W3 specs, including crossorigin on fonts (@dimitri-koenig)

### [1.4.3] - 2020-06-03
#### Added
- Extends layout configuration with options for fonts, images and styles (@dimitri-koenig)

### [1.4.2] - 2020-02-17
#### Fixed
- If link is full URL, try to turn it into absolute path

### [1.4.1] - 2019-09-10
#### Fixed
- Prevent HTTP/HTTPS URLs to be turned into static content URLs

### [1.4.0] - 2019-09-08
#### Added
- Add better detection of stylesheets (rel=stylesheet instead of as=style)
- Add XML layout instructions for custom additional links to be set
- Increase requirement for framework 102 or higher

### [1.3.0] - 2019-05-03
#### Added
- Add a flag "Skip Images" 
- Skip image when Yireo Webp2 is installed

### [1.2.0] - 2019-04-23
#### Changed
- Changed name of module from `ServerPush` to `LinkPreload`

### [1.1.0] - 2019-04-19
#### Added
- Add a separate `Config` class
- Add a CHANGELOG

#### Changed
- Changed paths in System Configuration
- Make cookie check optional, because it only *might* be needed with Varnish
- Remove frontend-check, so it also works for backend :)

#### Removed
- Make several `protected` methods `private`

### [1.0.0] - 2019-03
#### Added
- Add a cookie to stop serving `Link` headers after initial request

### [0.0.1] - 2018
#### Added
- Initial release

## Recent Versions

| Version | Released |
|---|---|
| 1.4.25 | 2026-05-19 |
| 1.4.24 | 2025-09-09 |
| 1.4.23 | 2025-09-09 |
| 1.4.22 | 2024-03-04 |
| 1.4.21 | 2023-05-26 |
| 1.4.20 | 2023-05-10 |
| 1.4.19 | 2022-10-04 |
| 1.4.18 | 2022-06-26 |
| 1.4.17 | 2022-06-18 |
| 1.4.16 | 2022-04-05 |

Showing 10 of 38 versions. Full release history on https://packagento.com/yireo/magento2-linkpreload.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| ext-pcre | * |
| magento/framework | ^102.0\|^103.0 |
| magento/module-backend | ^101.0\|^102.0 |
| magento/module-config | ^100.0\|^101.0 |
| magento/module-store | ^100.0\|^101.0 |
| php | ^7.4\|^8.0\|^8.1\|^8.2 |
| symfony/dom-crawler | ^2.7\|^3.0\|^4.0\|^5.0\|^6.0\|^7.0 |

## Quality

Latest release (1.4.25) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 12 | 12 warnings (ruleset: Magento2) — 8 auto-fixable with phpcbf |
| PHPMD | Warning | 3 | 3 rule violations (UnusedFormalParameter:3) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 4 | 4 | – | – |
| 2.4.8 | – | 4 | 4 | – |
| 2.4.9 | – | – | 4 | 4 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["yireo/magento2-linkpreload"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

yireo is a Magento 2 vendor on Packagento. See https://packagento.com/yireo.md for their full catalogue.

