PHPackages                             matthewbdaly/laravel-dynamic-serving - 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. matthewbdaly/laravel-dynamic-serving

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

matthewbdaly/laravel-dynamic-serving
====================================

Dynamic serving middleware for Laravel

0.0.2(8y ago)5390MITPHP

Since Apr 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/matthewbdaly/laravel-dynamic-serving)[ Packagist](https://packagist.org/packages/matthewbdaly/laravel-dynamic-serving)[ RSS](/packages/matthewbdaly-laravel-dynamic-serving/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (9)Versions (3)Used By (0)

laravel-dynamic-serving
=======================

[](#laravel-dynamic-serving)

[![Build Status](https://camo.githubusercontent.com/6ebdb76990c186d6344ef4450908bfeda6556f824f70f8d2a13bcb988c966a4a/68747470733a2f2f7472617669732d63692e6f72672f6d6174746865776264616c792f6c61726176656c2d64796e616d69632d73657276696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/matthewbdaly/laravel-dynamic-serving)[![Coverage Status](https://camo.githubusercontent.com/8bebf6209aa716a2ab018c66e1d159ae48bcb7322f0c55d1b2f272190b4e1dbc/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6174746865776264616c792f6c61726176656c2d64796e616d69632d73657276696e672f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/matthewbdaly/laravel-dynamic-serving?branch=master)

Middleware for detecting mobile/tablet users and adding data to the session so that other parts of the application can dynamically serve different content as required, in order to implement [dynamic serving](https://developers.google.com/search/mobile-sites/mobile-seo/dynamic-serving).

How do I install it?
--------------------

[](#how-do-i-install-it)

```
$ composer require matthewbdaly/laravel-dynamic-serving
```

What does it do?
----------------

[](#what-does-it-do)

The package provides the middleware `Matthewbdaly\LaravelDynamicServing\Http\Middleware\DetectMobile`, which you can set globally, or use on just a subset of your routes as appropriate. It sets a key of `mobile` in your session when a user first navigates to a page behind this middleware, which you can then use to determine which views to show a user, based on whether this returns a value of `true` or `false`. In addition, it sets the `Vary` header to `User-Agent` in the response, which tells search engines and caching systems that the response will vary by user agent. If you want to be able to let the user override the default based on the user agent (which is a good idea), all you need to do is provide a means to toggle the `mobile` flag in the session - typically you'll want to do this via AJAX and reload the page afterwards.

It also provides the `is_mobile()` and `is_desktop()` helper functions. While you can use these to determine which view to load, it's likely to be more useful in views in order to determine whether or not to show a particular part of the view.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

2941d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a596e5052494181ddc20aedefbebef191cc81008e320df098608c54a1dea7350?d=identicon)[matthewbdaly](/maintainers/matthewbdaly)

---

Top Contributors

[![matthewbdaly](https://avatars.githubusercontent.com/u/450801?v=4)](https://github.com/matthewbdaly "matthewbdaly (11 commits)")

---

Tags

dynamic-service-registrieslaravelmiddlewarephplaravellumen

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/matthewbdaly-laravel-dynamic-serving/health.svg)

```
[![Health](https://phpackages.com/badges/matthewbdaly-laravel-dynamic-serving/health.svg)](https://phpackages.com/packages/matthewbdaly-laravel-dynamic-serving)
```

###  Alternatives

[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k676.0k10](/packages/hhxsv5-laravel-s)[palanik/lumen-cors

Cross-origin resource sharing (CORS) middleware for Lumen micro-framework.

101237.4k](/packages/palanik-lumen-cors)[neomerx/cors-illuminate

CORS (Cross-Origin Resource Sharing) support for Laravel and Lumen

4996.4k2](/packages/neomerx-cors-illuminate)[noitran/opendox

OpenApi(Swagger) 3.0 package for Lumen 5.5+ and Laravel 5.5+ with REDOC UI and SwaggerUI 3

2313.9k](/packages/noitran-opendox)

PHPackages © 2026

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