PHPackages                             jacobbennett/laravel-http2serverpush - 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. jacobbennett/laravel-http2serverpush

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

jacobbennett/laravel-http2serverpush
====================================

A HTTP2 Server Push Middleware for Laravel 5

v5.0.4(5y ago)292110.8k36[4 issues](https://github.com/JacobBennett/laravel-HTTP2ServerPush/issues)[1 PRs](https://github.com/JacobBennett/laravel-HTTP2ServerPush/pulls)MITPHPPHP ^7.0|^8.0CI failing

Since Jul 30Pushed 2y ago8 watchersCompare

[ Source](https://github.com/JacobBennett/laravel-HTTP2ServerPush)[ Packagist](https://packagist.org/packages/jacobbennett/laravel-http2serverpush)[ Docs](https://github.com/jacobbennett/laravel-http2serverpush)[ RSS](/packages/jacobbennett-laravel-http2serverpush/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (6)Versions (22)Used By (0)

[![](https://raw.githubusercontent.com/jacobbennett/laravel-http2serverpush/master/server-push.png)](https://raw.githubusercontent.com/jacobbennett/laravel-http2serverpush/master/server-push.png)

Server Push Middleware for Laravel 5
====================================

[](#server-push-middleware-for-laravel-5)

[![Latest Version on Packagist](https://camo.githubusercontent.com/055821a7745801b8d8db1bb02c3afb9e2d6d4a04ed540549f192e11d3a0241be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a61636f6262656e6e6574742f6c61726176656c2d4874747032536572766572507573682e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jacobbennett/laravel-http2serverpush)[![Travis](https://camo.githubusercontent.com/225509bff2cf25bbb40dda705eb42373b6c6625f1a97b4753ed0202df9abd9ce/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4a61636f6242656e6e6574742f6c61726176656c2d4854545032536572766572507573682e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://travis-ci.org/JacobBennett/laravel-HTTP2ServerPush)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/6b3592e7d92179bc80fc7ef88523d245db2c9bc442da2370b9ed81dfeab2c58a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61636f6262656e6e6574742f6c61726176656c2d6874747032736572766572707573682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jacobbennett/laravel-http2serverpush)

Server Push is a HTTP/2 concept which allows the server to speculatively start sending resources to the client. This can potentially speed up initial page load times: the browser doesn't have to parse the HTML page and find out which other resources to load, instead the server can start sending them immediately. [(source)](http://blog.xebia.com/http2-server-push/)

This package aims to provide the *easiest* experience for adding Server Push to your responses. Simply route your requests through the `AddHttp2ServerPush` middleware and it will automatically create and attach the `Link` headers necessary to implement Server Push for your CSS, JS and Image assets.

Requirements
------------

[](#requirements)

- Laravel 5
- PHP 7

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

[](#installation)

You can install the package via composer:

```
$ composer require jacobbennett/laravel-http2serverpush
```

Next you must add the `\JacobBennett\Http2ServerPush\Middleware\AddHttp2ServerPush`-middleware to the kernel. Adding it to the web group is recommeneded as API's do not have assets to push.

```
// app/Http/Kernel.php

...
protected $middlewareGroups = [
    'web' => [
        ...
        \JacobBennett\Http2ServerPush\Middleware\AddHttp2ServerPush::class,
        ...
    ],
    ...
];
```

Publish config
--------------

[](#publish-config)

```
php artisan vendor:publish --provider="JacobBennett\Http2ServerPush\ServiceProvider"
```

Usage
-----

[](#usage)

When you route a request through the `AddHttp2ServerPush` middleware, the response is scanned for any `link`, `script` or `img` tags that could benefit from being loaded using Server Push. These assets will be added to the `Link` header before sending the response to the client. Easy!

**Note:** To push an image asset, it must have one of the following extensions: `bmp`, `gif`, `jpg`, `jpeg`, `png`, `tiff` or `svg`.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jacob Bennett](https://github.com/jacobbennett)
- [All Contributors](../../contributors)

Thanks to the  package for providing a great starting point for testing Middlewares.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

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 ~89 days

Recently: every ~113 days

Total

21

Last Release

1827d ago

Major Versions

v1.3 → v2.0.02017-05-30

v2.0.6 → v3.0.02019-09-19

v3.0.0 → v4.0.02019-11-22

v4.0.2 → v5.0.02020-03-26

PHP version history (5 changes)v1.0PHP ^5.5.0|^7.0

v1.3PHP ^5.5|^7.0

v4.0.0PHP ^7.0

v5.0.1PHP ^7.2

v5.0.4PHP ^7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/50837c1464ddeb5a0d132c151fe7cde07e050e67206d50470d92f1e72cc7179e?d=identicon)[JacobBennett](/maintainers/JacobBennett)

---

Top Contributors

[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (5 commits)")[![moebrowne](https://avatars.githubusercontent.com/u/8448512?v=4)](https://github.com/moebrowne "moebrowne (3 commits)")[![Nuranto](https://avatars.githubusercontent.com/u/1633463?v=4)](https://github.com/Nuranto "Nuranto (2 commits)")[![f-liva](https://avatars.githubusercontent.com/u/346224?v=4)](https://github.com/f-liva "f-liva (1 commits)")[![gayanhewa](https://avatars.githubusercontent.com/u/1681406?v=4)](https://github.com/gayanhewa "gayanhewa (1 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (1 commits)")[![MadMikeyB](https://avatars.githubusercontent.com/u/831828?v=4)](https://github.com/MadMikeyB "MadMikeyB (1 commits)")[![matijakovacevic](https://avatars.githubusercontent.com/u/2469719?v=4)](https://github.com/matijakovacevic "matijakovacevic (1 commits)")[![multiwebinc](https://avatars.githubusercontent.com/u/901732?v=4)](https://github.com/multiwebinc "multiwebinc (1 commits)")[![ninjaparade](https://avatars.githubusercontent.com/u/228899?v=4)](https://github.com/ninjaparade "ninjaparade (1 commits)")[![prestamodule](https://avatars.githubusercontent.com/u/1162527?v=4)](https://github.com/prestamodule "prestamodule (1 commits)")[![atayahmet](https://avatars.githubusercontent.com/u/1698044?v=4)](https://github.com/atayahmet "atayahmet (1 commits)")[![tankerkiller125](https://avatars.githubusercontent.com/u/3457368?v=4)](https://github.com/tankerkiller125 "tankerkiller125 (1 commits)")[![biscofil](https://avatars.githubusercontent.com/u/1677625?v=4)](https://github.com/biscofil "biscofil (1 commits)")[![ctf0](https://avatars.githubusercontent.com/u/7388088?v=4)](https://github.com/ctf0 "ctf0 (1 commits)")

---

Tags

http2laravelmiddlewarelaravelserverpushlaravel-http2serverpush

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jacobbennett-laravel-http2serverpush/health.svg)

```
[![Health](https://phpackages.com/badges/jacobbennett-laravel-http2serverpush/health.svg)](https://phpackages.com/packages/jacobbennett-laravel-http2serverpush)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[justbetter/laravel-http3earlyhints

A HTTP3 Early Hints Middleware for Laravel

1969.3k4](/packages/justbetter-laravel-http3earlyhints)[onlime/laravel-http-client-global-logger

A global logger for the Laravel HTTP Client

2037.5k](/packages/onlime-laravel-http-client-global-logger)

PHPackages © 2026

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