tattali/mobile-detect-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tattali/mobile-detect-bundle

最新稳定版本:v7.0.0

Composer 安装命令:

composer require tattali/mobile-detect-bundle

包简介

Symfony 5.x-7.x bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version.

README 文档

README

Mobile Detect

MobileDetectBundle

Symfony 5.4.x-7.0 bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version.

Github Actions Status Latest Stable Version Packagist Downloads Coverage Packagist License Packagist Dependency Version

This bundle is a fork of suncat2000/MobileDetectBundle. As this project doesn't look maintained anymore, we decided to create & maintain a fork. For more information read our manifest.

Introduction

This Bundle use MobileDetect class and provides the following features:

  • Detect the various mobile devices by Name, OS, browser User-Agent

  • Manages site views for the various mobile devices (mobile, tablet, desktop)

  • Redirects to mobile and tablet sites

  • Migrate to 7x

Documentation

Installation

composer require tattali/mobile-detect-bundle

Install with Symfony legacy versions: here

Usage

Checking device

use Detection\MobileDetect;

public function someaction(MobileDetect $mobileDetector)
{
    $mobileDetector->isMobile();
    $mobileDetector->isTablet();
    $mobileDetector->is('iPhone');
}

With Twig

{% if is_mobile() %}
{% if is_tablet() %}
{% if is_device('iPhone') %} # magic methods is[...]

Available User-Agents (uaMatch) with the php is() and twig is_device() here

Switch device view

For switch device view, use device_view GET parameter:

https://localhost:8000?device_view={desktop/mobile/tablet}

Or using the Symfony toolbar mbd-bundle-sf-toolbar

Going further

Contribute and feedback

Any feedback and contribution will be very appreciated.

License and credits

This bundle is under the MIT license. See the complete license in the bundle

Original authors: suncat2000, HenriVesala, netmikey and all contributors

统计信息

  • 总下载量: 933.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 37
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 37
  • Watchers: 1
  • Forks: 155
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-25