承接 mhmmdq/useragent 相关项目开发

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

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

mhmmdq/useragent

最新稳定版本:1.0.0

Composer 安装命令:

composer require mhmmdq/useragent

包简介

A small package to identify the user's browser

README 文档

README

This package extracts $_SERVER['HTTP_USER_AGENT'] details of the client browser and provides the details to you as an array.

Installation

Installed by Composer

$ composer require mhmmdq\useragent

How to use

To use the package, first add the Autoloder Composer file to the software and then call the class

<?php

require __DIR__ . '/vendor/autoload.php';

use Mhmmdq\Useragent\UserAgent;

$useragent = UserAgent::analyze();

var_dump($useragent);

The output provides you with user information that has the following information

useragent useragent received from the client browser

browser An array containing the name and version of the client browser

platform Client platform

language Client browser language derived from $_SERVER['HTTP_ACCEPT_LANGUAGE'] analysis

is_mobile Check whether the client is mobile or not (The output of this value is true or false)

If you need to check different user agents, you can pass them to the analysis method
$useragent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36';
var_dump(UserAgent::analyze($useragent));

Check if the client is mobile or not

You can use the following method to do this

UserAgent::is_mobile();
Example
if(UserAgent::is_mobile()) {
    header('location: https://m.example.com');
}

Get the default browser language

The default language of the client browser is received using $_SERVER['HTTP_ACCEPT_LANGUAGE'] and after checking the output is provided as a string

UserAgent::lang();

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固