PHPackages                             analyticsface/yii2-mobile-detector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. analyticsface/yii2-mobile-detector

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

analyticsface/yii2-mobile-detector
==================================

Mobile detector for Yii2 Framework.

048PHP

Since Apr 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/analyticsface/yii2-mobile-detector)[ Packagist](https://packagist.org/packages/analyticsface/yii2-mobile-detector)[ RSS](/packages/analyticsface-yii2-mobile-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Aface Mobile Detect
===================

[](#aface-mobile-detect)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/). This requires the composer-asset-plugin, which is also a dependency for yii2 – so if you have yii2 installed, you are most likely already set.

Either run

```
composer require analyticsface/yii2-mobile-detector:*

```

or add

```
"analyticsface/yii2-mobile-detector" : "*"
```

to the require section of your application's `composer.json` file.

Usage
-----

[](#usage)

add rule for hide 'index' action

```
'/' => '/index'

```

1. Add to /frontend/config/bootstrap.php

```
Yii::$container->set('aface\mobiledetector\mode\ClientMode', function () {
    return new \aface\mobiledetector\mode\ClientMode(Yii::$app->request);
});

```

2. Add to 'components' view

```
'components' => [
        'view' => function (\aface\mobiledetector\mode\ViewMode $mode) {
            return Yii::createObject([
                'class' => 'yii\web\View',
                'theme' => $mode->isMobile()
                    ? [
                        'basePath' => '@frontend/themes/mobile',
                        'baseUrl' => '@web',
                        'pathMap' => [
                            '@frontend/views' => '@frontend/themes/mobile/views',
                        ],
                    ]
                    : [
                        'basePath' => '@frontend/themes/desktop',
                        'baseUrl' => '@web',
                        'pathMap' => [
                            '@frontend/views' => '@frontend/themes/desktop/views',
                        ],
                    ],
            ]);
        },
        ...
    ]

```

3. Add filter 'as viewMode'

```
 'components' => [
        ...
    ],
    'as viewMode' => [
        'class' => 'aface\mobiledetector\filter\ViewModeFilter',
        'expire' => 30 * 86400 // 30 days
    ],
    'params' => $params,

```

4. Add to layout switch link

```

```

5. If css/js files used from theme

a) add to main Asset

```
public $sourcePath = '@theme';

```

b) add alias

```
'components' => [
        'view' => function (\aface\mobiledetector\mode\ViewMode $mode) {

            $theme = Yii::$app->request->getCookies()->getValue(\aface\mobiledetector\mode\ClientMode::COOKIE_NAME);

            if ($theme === null) {
                $theme = $mode->isMobile() ? 'mobile' : 'desktop';
            }

            Yii::setAlias('theme', '@frontend/themes/' . $theme);

            ...
        },
        ...
    ]

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![vladimirovii](https://avatars.githubusercontent.com/u/11423651?v=4)](https://github.com/vladimirovii "vladimirovii (7 commits)")

### Embed Badge

![Health badge](/badges/analyticsface-yii2-mobile-detector/health.svg)

```
[![Health](https://phpackages.com/badges/analyticsface-yii2-mobile-detector/health.svg)](https://phpackages.com/packages/analyticsface-yii2-mobile-detector)
```

###  Alternatives

[tobion/retry

A generic library to retry an operation in case of an error. You can configure the behavior like the exceptions to retry on.

16396.8k](/packages/tobion-retry)[franzose/laravel-smpp

SMS sending via SMPP protocol for Laravel framework.

3941.6k1](/packages/franzose-laravel-smpp)[cammac/carbony

convert from/to Hijri and Gregorian

2443.0k](/packages/cammac-carbony)[steevanb/symfony-container-introspection

Get all Symfony Container informations you need: registered services, instanciated services etc

1034.5k](/packages/steevanb-symfony-container-introspection)

PHPackages © 2026

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