PHPackages                             facile-it/laminas-link-headers-module - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. facile-it/laminas-link-headers-module

ActiveLibrary[HTTP &amp; Networking](/categories/http)

facile-it/laminas-link-headers-module
=====================================

Laminas module to push Link headers for resourcers added with HeadLink view helper

1.0.0(6y ago)031.3k—9.3%[2 PRs](https://github.com/facile-it/laminas-link-headers-module/pulls)MITPHPPHP ^7.1CI passing

Since Jan 23Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/facile-it/laminas-link-headers-module)[ Packagist](https://packagist.org/packages/facile-it/laminas-link-headers-module)[ Docs](https://github.com/facile-it/laminas-link-headers-module)[ RSS](/packages/facile-it-laminas-link-headers-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (14)Versions (5)Used By (0)

LaminasLinkHeadersModule
========================

[](#laminaslinkheadersmodule)

[![Travis](https://camo.githubusercontent.com/681725ad0097599f2a466484d9f5c24adbb4c43fdf6397e2daa1ca77cc60417e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f666163696c652d69742f6c616d696e61732d6c696e6b2d686561646572732d6d6f64756c652e737667)](https://travis-ci.org/facile-it/laminas-link-headers-module)[![Scrutinizer Coverage](https://camo.githubusercontent.com/bce1f70d719f05382fdcdf4603a76a0dc0f02c4812e52a462e2d8cc67ff42177/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f666163696c652d69742f6c616d696e61732d6c696e6b2d686561646572732d6d6f64756c652e737667)](https://scrutinizer-ci.com/g/facile-it/laminas-link-headers-module/)[![Scrutinizer](https://camo.githubusercontent.com/f35cd1a7d84a621c8f958a566f09a6a7d616f9cf73adc3376a7a1406a2f69647/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666163696c652d69742f6c616d696e61732d6c696e6b2d686561646572732d6d6f64756c652e737667)](https://scrutinizer-ci.com/g/facile-it/laminas-link-headers-module/)[![GitHub release](https://camo.githubusercontent.com/fa78de65c3f29fed47b0f36aa657255c58cf1de37d9782971430ca5d8ea5048f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f666163696c652d69742f6c616d696e61732d6c696e6b2d686561646572732d6d6f64756c652e737667)](https://github.com/facile-it/laminas-link-headers-module)

This module will automatically sends `Link` HTTP headers supporting [resource hints](https://www.w3.org/TR/resource-hints/)and [preload](https://www.w3.org/TR/preload/), via HTTP headers.

Currently supported hints
-------------------------

[](#currently-supported-hints)

From [`OptionsInterface`](src/OptionsInterface.php):

```
public const MODE_PRELOAD = 'preload';
public const MODE_PREFETCH = 'prefetch';
public const MODE_DNS_PREFETCH = 'dns-prefetch';
public const MODE_PRECONNECT = 'preconnect';
public const MODE_PRERENDER = 'prerender';
```

Configuration
-------------

[](#configuration)

This is the default configuration and options can be overridden in your configuration.

```
return [
    'facile' => [
        'laminas_link_headers_module' => [
            'stylesheet_enabled' => false, // send link headers for stylesheet links
            'stylesheet_mode' => 'preload', // resource hint for stylesheet links
            'script_enabled' => false, // send link headers for scripts
            'script_mode' => 'preload', // resource hint for script links
            'http2_push_enabled' => true, // if disabled, a "nopush" attributed will be added to disable HTTP/2 push
        ],
    ],
];
```

Example
-------

[](#example)

### Configuration:

[](#configuration-1)

Default configuration:

```
return [
    'facile' => [
        'laminas_link_headers_module' => [
            'stylesheet_enabled' => false, // send link headers for stylesheet links
            'stylesheet_mode' => 'preload', // resource hint for stylesheet links
            'script_enabled' => false, // send link headers for scripts
            'script_mode' => 'preload', // resource hint for script links
            'http2_push_enabled' => true, // if disabled, a "nopush" attributed will be added to disable HTTP/2 push
        ],
    ],
];
```

### Template

[](#template)

In your template:

```
DOCTYPE html>
