exs / php-user-agent-bundle

用于 https://github.com/donatj/PhpUserAgent/ 的全局函数包装器

v2.0.0 2019-08-12 10:28 UTC

This package is auto-updated.

Last update: 2024-08-28 02:35:35 UTC


README

用于 https://github.com/donatj/PhpUserAgent/ 的全局函数包装器 https://github.com/donatj/PhpUserAgent/

在新的 Symfony2 项目中安装 # EXS-PhpUserAgentBundle

使用 # EXS-PhpUserAgentBundle 依赖编辑 composer.json 文件

//composer.json
//...
"require": {
    //other bundles
    "exs/php-user-agent-bundle": "^1.0"
},

保存文件并通过命令行运行 composer update 以更新项目

composer update exs/php-user-agent-bundle"

更新 app/AppKernel.php

//app/AppKernel.php
//...
public function registerBundles()
{
    $bundles = array(
    //Other bundles
    new EXS\PhpUserAgentBundle\EXSPhpUserAgentBundle(),
);

用法

// initiate the service
$service = new EXS\PhpUserAgentBundle\Services\PhpUserAgentService();
$service->parseUserAgent(USER_AGENT_STRING_HERE);

// Get the detected platform type
$service->getFlatform();

// Get the detected browser type
$service->getBrowser();

// Get the detected browser version
$service->getVersion();

贡献

欢迎任何人和每个人贡献。

如果您有任何问题或建议,请 告诉我们