yireo / magento2-linkpreload

yireo/magento2-linkpreload

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

  • Jisse Reitsma (Yireo)
magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: Pass Security: Pass OSL-3.0

Yireo LinkPreload

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:

Changelog

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

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[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
Versions
Version Stability QA Status Compatibility Released
1.4.25 stable Fail Magento 2.4.7-2.4.9 Details 2026-05-19 13:33:19
1.4.24 stable Not tested Not yet tested Details 2025-09-09 07:35:31
1.4.23 stable Not tested Not yet tested Details 2025-09-09 07:30:42
1.4.22 stable Not tested Not yet tested Details 2024-03-04 11:43:04
1.4.21 stable Not tested Not yet tested Details 2023-05-26 07:54:29
1.4.20 stable Not tested Not yet tested Details 2023-05-10 16:54:16
1.4.19 stable Not tested Not yet tested Details 2022-10-04 07:54:13
1.4.18 stable Not tested Not yet tested Details 2022-06-26 05:11:10
1.4.17 stable Not tested Not yet tested Details 2022-06-18 06:44:34
1.4.16 stable Not tested Not yet tested Details 2022-04-05 09:25:19
1.4.15 stable Not tested Not yet tested Details 2022-03-31 09:48:47
1.4.14 stable Not tested Not yet tested Details 2022-02-20 12:58:36
1.4.13 stable Not tested Not yet tested Details 2022-01-19 15:54:13
1.4.12 stable Not tested Not yet tested Details 2021-07-08 15:49:51
1.4.11 stable Not tested Not yet tested Details 2021-07-07 10:45:09
1.4.10 stable Not tested Not yet tested Details 2021-06-15 16:18:12
1.4.9 stable Not tested Not yet tested Details 2021-06-15 16:04:22
1.4.8 stable Not tested Not yet tested Details 2021-01-12 07:07:11
1.4.7 stable Not tested Not yet tested Details 2021-01-07 18:01:03
1.4.6 stable Not tested Not yet tested Details 2020-07-29 09:41:37
1.4.5 stable Not tested Not yet tested Details 2020-07-20 16:44:31
1.4.4 stable Not tested Not yet tested Details 2020-06-12 12:42:01
1.4.3 stable Not tested Not yet tested Details 2020-06-03 12:44:25
1.4.2 stable Not tested Not yet tested Details 2020-02-17 12:43:54
1.4.1 stable Not tested Not yet tested Details 2019-09-10 08:35:17
1.4.0 stable Not tested Not yet tested Details 2019-09-08 16:13:56
1.3.0 stable Not tested Not yet tested Details 2019-05-03 06:05:52
1.2.0 stable Not tested Not yet tested Details 2019-04-23 08:48:47
1.1.0 stable Not tested Not yet tested Details 2019-04-19 16:01:51
1.0.0 stable Not tested Not yet tested Details 2018-12-29 17:48:35
0.0.8 stable Not tested Not yet tested Details 2018-12-28 21:58:54
0.0.7 stable Not tested Not yet tested Details 2018-12-11 21:38:17
0.0.6 stable Not tested Not yet tested Details 2018-12-10 13:09:46
0.0.5 stable Not tested Not yet tested Details 2018-11-29 20:34:25
0.0.4 stable Not tested Not yet tested Details 2018-10-26 13:33:16
0.0.3 stable Not tested Not yet tested Details 2018-07-17 07:09:22
0.0.2 stable Not tested Not yet tested Details 2017-05-31 15:34:54
0.0.1 stable Not tested Not yet tested Details 2017-02-18 15:19:29

Requires 7

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

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
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. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. 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.

Static analysis results
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's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.

PHPStan results by Magento and PHP version
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 for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
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

Integration tests results by Magento and PHP version
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

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
OSL-3.0
Homepage
https://www.yireo.com/software/magento-extensions/linkpreload
Authors

More from yireo

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.