定制 alexandernst/yii2-device-detect 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexandernst/yii2-device-detect

最新稳定版本:0.0.12

Composer 安装命令:

composer require alexandernst/yii2-device-detect

包简介

Yii2 extension for Mobile-Detect library

README 文档

README

Yii2 extension for Mobile-Detect library.

To use it just require this extension in your composer.json file:

"alexandernst/yii2-device-detect": "0.0.12",

And then add it to your components configuration in Yii2:

'bootstrap' => ['devicedetect'],
'components' => [
	'devicedetect' => [
		'class' => 'alexandernst\devicedetect\DeviceDetect'
	],
]

Some basic detections are available in Yii's params:

var_dump(Yii::$app->params['devicedetect']);

array (size=3)
  'isMobile' => boolean false
  'isTablet' => boolean false
  'isDesktop' => boolean true

You can also use it from anywhere in your code, calling Mobile-Detect's API:

/*Detect a mobile device*/
\Yii::$app->devicedetect->isMobile();

/*Detect a tablet device*/
\Yii::$app->devicedetect->isTablet();

/*Check all available methods here: http://demo.mobiledetect.net/ */

Or using the an alias:

\Yii::getAlias('@device'); //return 'mobile', 'tablet' or 'desktop'.

统计信息

  • 总下载量: 821k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 141
  • 点击次数: 3
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 136
  • Watchers: 10
  • Forks: 36
  • 开发语言: PHP

其他信息

  • 授权协议: GNU
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固