browscap/browscap-bundle
Composer 安装命令:
composer require browscap/browscap-bundle
包简介
Allows you to get browser information
README 文档
README
This is a service for you that is similar to the php function get_browser(). It uses https://github.com/GaretJax/phpbrowscap project.
Installation
php composer.phar require browscap/browscap-bundle:1.0.*
This will install the current version which is beta and is the master branch. I don't want to say it's stable yet until I have some more tests and real world usage under the belt, but should be good enough to use in a production site.
In your app/AppKernel.php file
public function registerBundles()
{
...
$bundles = array(
...
new Browscap\BrowscapBundle\BrowscapBundle(),
...
);
...
}
Configuration
You can see the configuration values and information by running php app/console config:dump-reference BrowscapBundle
browscap:
remote_ini_url: http://tempdownloads.browserscap.com/stream.php?BrowsCapINI
remote_ver_url: http://tempdownloads.browserscap.com/versions/version-date.php
cache_dir: null # If null, use your application cache directory
timeout: 5
update_interval: 432000
error_interval: 7200
do_auto_update: true
update_method: 'cURL' # Supported methods: 'URL-wrapper','socket','cURL' and 'local'.
local_file: null # Only if used
cache_filename: 'cache.php'
ini_filename: 'browscap.ini'
lowercase: false # You need to rebuild the cache if this option is changed
silent: false
Usage
In your controller, you will just need to get the browser information via the dependency injection container.
// @var $browscap \Browscap\BrowscapBundle\Browscap
$browscap = $this->container->get('browscap');
$browser = $browscap->getBrowser();
In twig templates, you can call the get_browser function :
{% set browser = get_browser() %}
In the future there might be some more functions.
browscap/browscap-bundle 适用场景与选型建议
browscap/browscap-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98.9k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2013 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「browser」 「Browscap」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 browscap/browscap-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 browscap/browscap-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 browscap/browscap-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
UserAgent parsing done right http://useragent.mkf.solutions/
Give your JS App some Backbone with Models, Views, Collections, and Events.
The standalone PHP Browscap parser Crossjoin\Browscap detects browser properties as well as device information based on the user agent string of the requesting browsers and search engines, using the data from the Browser Capabilities Project. It's several hundred times faster than the build-in PHP f
UserAgent parsing done right http://useragent.mkf.solutions/
Browser Capabilities Tools
Browscap-PHP integration for Laravel 5-12
统计信息
- 总下载量: 98.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-12