guiliredu/simple-user-agent 问题修复 & 功能扩展

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

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

guiliredu/simple-user-agent

最新稳定版本:1.0.2

Composer 安装命令:

composer require guiliredu/simple-user-agent

包简介

A package to get info from a user agent

README 文档

README

A simple class to parse data from a user agent.

<?php

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

use SimpleUserAgent\UserAgent;

$agent = new UserAgent();

You can set a user agent in the first parameter of the constructor. If the parameter is empty, it will try to parse data from $_SERVER['HTTP_USER_AGENT']

$agent = new UserAgent('Mozilla/5.0 ...');

You can set a user agent after instantiation, calling this method:

$agent->setAgent('Mozilla/5.0 ...');

To get the data, you can call these available methods

$agent->getAgent() // Full user agent string
$agent->getDevice() // iPhone
$agent->getOS() // iOS
$agent->getBrowser() // Apple Safari
$agent->getPrefix() // Safari
$agent->getVersion() // 11.0
$agent->getEngine() // WebKit
$agent->isBot() // true / false
$agent->getInfo() // Array with all the above info

This project is under development - For test purposes only

References:

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-14