承接 kwenziwa/devicedetector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kwenziwa/devicedetector

Composer 安装命令:

composer require kwenziwa/devicedetector

包简介

Device Detector is a versatile, easy-to-use package for project that provides seamless device and operating system detection. Leveraging the robustness of mobiledetect/mobiledetectlib, this package allows developers to quickly identify whether a user is accessing their application from a mobile dev

README 文档

README

Device Detector is a convenient package for applications, offering easy detection of user devices and their operating systems. Utilizing the mobiledetect/mobiledetectlib library, this package enables applications to quickly identify device types (mobile, tablet, desktop) and operating systems (iOS, Android, etc.), enhancing the user experience and providing valuable insights.

Features

  • Detect whether the user's device is a mobile, tablet, or desktop
  • Identify the operating system of the user's device (iOS, Android, etc.)
  • Lightweight and easy to integrate into any project

Installation

Install the package via composer:

composer require kwenziwa/devicedetector

Usage

After installation, you can use the DeviceDetector in your application as follows:

use Kwenziwa\DeviceDetector\DeviceDetector;

$deviceDetector = app(DeviceDetector::class);

if ($deviceDetector->isMobile()) {
    // Handle mobile device
}

if ($deviceDetector->isTablet()) {
    // Handle tablet device
}

if ($deviceDetector->isDesktop()) {
    // Handle desktop device
}

Methods

isMobile()

Determines if the user's device is a mobile phone.

$deviceDetector->isMobile();

isTablet()

Determines if the user's device is a tablet.

$deviceDetector->isTablet();

isDesktop()

Determines if the user's device is a desktop. This is typically the default if the device is neither a mobile nor a tablet.

$deviceDetector->isDesktop();

isIOS()

Checks if the user's device is running iOS.

$deviceDetector->isIOS();

isAndroidOS()

Checks if the user's device is running Android OS.

$deviceDetector->isAndroidOS();

getDeviceType()

Returns the type of the user's device as a string ('mobile', 'tablet', or 'desktop').

$deviceType = $deviceDetector->getDeviceType();

getOSType()

Returns the operating system of the user's device as a string (e.g., 'iOS', 'Android', 'Windows Mobile', 'BlackBerry', 'Symbian', or 'Unknown').

$osType = $deviceDetector->getOSType();

getBrowser()

Returns the the browser name system of the user's device as a string.

$detector = new DeviceDetector();

$browser = $detector->getBrowser();
echo "Browser: $browser";

Run the Tests

Run the tests using the PHPUnit command:

./vendor/bin/phpunit

This command will execute all tests in your tests directory. The above tests are basic and might not effectively cover all scenarios since the actual device type and OS will depend on the environment where the tests are run. In a more comprehensive test suite, you would mock the MobileDetect class to simulate different devices and operating systems. This would allow you to test all branches of your code.

Contributing

Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.

License

The Device Detector is open-sourced software licensed under the MIT license.

kwenziwa/devicedetector 适用场景与选型建议

kwenziwa/devicedetector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 kwenziwa/devicedetector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kwenziwa/devicedetector 我们能提供哪些服务?
定制开发 / 二次开发

基于 kwenziwa/devicedetector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-28