定制 reefki/laravel-device-detector 二次开发

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

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

reefki/laravel-device-detector

最新稳定版本:v2.0.0

Composer 安装命令:

composer require reefki/laravel-device-detector

包简介

Laravel wrapper for Matomo's Universal Device Detection library.

README 文档

README

tests

The Laravel wrapper for Matomo Universal Device Detection library seamlessly integrates device detection capabilities into Laravel applications.

Installation

This package can be installed through Composer.

composer require reefki/laravel-device-detector

Optionally, you can publish the config file of this package with this command:

php artisan vendor:publish --provider="Reefki\DeviceDetector\DeviceDetectorServiceProvider" --tag="config"

Usage

Detect device from a user agent string:

use Reefki\DeviceDetector\Device;

$device = Device::detect($request->userAgent());

Detect device from a user agent string and optional hints:

use Reefki\DeviceDetector\Device;

$device = Device::detect($request->userAgent(), $request->server());

Detect device from a request instance:

use Reefki\DeviceDetector\Device;

$device = Device::detectRequest($request);

Detect device directly from a request instance:

$device = $request->device();

All of the above methods wil return a DeviceDetector\DeviceDetector instance which you can use to get the information about the device:

if ($device->isBot()) {
    $botInfo = $device->getBot();
} else {
    $clientInfo = $device->getClient();
    $osInfo = $device->getOs();
    $deviceName = $device->getDeviceName();
    $brand = $device->getBrandName();
    $model = $device->getModel();
}

Read the Matomo's Universal Device Detection library readme for more information on how to use the returned instance.

Testing

Run the tests with:

vendor/bin/phpunit

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 27
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固