PHPackages                             torann/device-view - 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. [Templating &amp; Views](/categories/templating)
4. /
5. torann/device-view

ActiveLibrary[Templating &amp; Views](/categories/templating)

torann/device-view
==================

Provides support for device based view layouts in Laravel.

0.0.4(9y ago)146.6k1BSD 2-ClausePHPPHP &gt;=5.5.9

Since Aug 12Pushed 8y ago2 watchersCompare

[ Source](https://github.com/Torann/device-view)[ Packagist](https://packagist.org/packages/torann/device-view)[ RSS](/packages/torann-device-view/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

Laravel Device View
===================

[](#laravel-device-view)

[![Total Downloads](https://camo.githubusercontent.com/b8537b5c4fa2664d4f542c6a974277ca0b9db5666d854a1346959c541f8b29d4/68747470733a2f2f706f7365722e707567782e6f72672f746f72616e6e2f67656f69702f646f776e6c6f6164732e706e67)](https://packagist.org/packages/torann/device-view)[![Patreon donate button](https://camo.githubusercontent.com/f9e075baad95563481d35174d43ef50757281abb6bc795d0f473fad452afa030/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d646f6e6174652d79656c6c6f772e737667)](https://www.patreon.com/torann)[![Donate weekly to this project using Gratipay](https://camo.githubusercontent.com/0eeae019980adaa1dc64842cfb01f3d738c688982ea4eb58094047011cb46704/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f67726174697061792d646f6e6174652d79656c6c6f772e737667)](https://gratipay.com/~torann)[![Donate to this project using Flattr](https://camo.githubusercontent.com/d79e412f78041f87e203449041ad81848a8405cf0f3c622c51e3bad0c2a4b599/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666c617474722d646f6e6174652d79656c6c6f772e737667)](https://flattr.com/profile/torann)[![Donate to this project using Paypal](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4CJA2A97NPYVU)

- [Device View on Packagist](https://packagist.org/packages/torann/device-view)
- [Device View on GitHub](https://github.com/Torann/device-view)

Dynamically change Laravel views based on the visitor's device.

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

[](#installation)

### Composer

[](#composer)

From the command line run:

```
composer require torann/device-view

```

### Setup

[](#setup)

This package extends Laravel's built in `ViewServiceProvider`, so that provider must be replaced in `app/app.php`. Replace the instance of `'Illuminate\View\ViewServiceProvider',` with `'Torann\DeviceView\DeviceViewServiceProvider',`.

### Publish the configurations

[](#publish-the-configurations)

Run this on the command line from the root of your project:

```
$ php artisan vendor:publish --provider="Torann\DeviceView\DeviceViewServiceProvider"

```

A configuration file will be publish to `config/device-view.php`.

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

[](#configuration)

The default settings are for the device views to be in the `views` directory in `resources/` with the default theme called `default`.

```
resources/
    views/
        default/
        mobile/
        tablet/

```

Usage
-----

[](#usage)

A standard call to `View::make('index')` will look for an index view in `resources/views/default/`. However, if a theme is specified with `$app['view.finder']->setDeviceView('mobile');` prior to calling `View::make()` then the view will first be looked for in `resources/views/mobile/views`. If the view is not found for the current theme the default theme will then be searched.

### Facade

[](#facade)

The `DeviceView` facade can also be used if preferred `DeviceView::setDeviceView('mobile')` by adding an entry for `Torann\DeviceView\Facades\DeviceView` to `config/app.php`.

### Helper Methods

[](#helper-methods)

**DeviceView::getPlatform()**

Return the user's operating system.

Example
-------

[](#example)

Given a directory structure of:

```
resources/
    views/
        default/
            layout.blade.php
            admin.blade.php
        mobile/
            layout.blade.php

```

```
View::make('layout'); // Loads resources/views/default/layout.blade.php

$app['view.finder']->setDeviceView('default');

View::make('layout'); // Loads resources/views/mobile/layout.blade.php
View::make('admin'); // Loads resources/views/default/admin.blade.php

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

3398d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1406755?v=4)[Daniel Stainback](/maintainers/torann)[@Torann](https://github.com/Torann)

---

Top Contributors

[![Torann](https://avatars.githubusercontent.com/u/1406755?v=4)](https://github.com/Torann "Torann (15 commits)")

---

Tags

laravelviewthemes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/torann-device-view/health.svg)

```
[![Health](https://phpackages.com/badges/torann-device-view/health.svg)](https://phpackages.com/packages/torann-device-view)
```

###  Alternatives

[delatbabel/viewpages

Support rendering/view of Laravel pages and templates from a database.

121.4k](/packages/delatbabel-viewpages)

PHPackages © 2026

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