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)5399MITPHP

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 2w 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

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

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

3035d 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

[palanik/lumen-cors

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

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

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

4897.0k2](/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

2314.6k](/packages/noitran-opendox)[openapi/openapi-sdk

Minimal and agnostic PHP SDK for Openapi® (https://openapi.com)

164.6k1](/packages/openapi-openapi-sdk)

PHPackages © 2026

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