承接 alexander-suter/yii2-browser-info 相关项目开发

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

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

alexander-suter/yii2-browser-info

最新稳定版本:2.0.2

Composer 安装命令:

composer require alexander-suter/yii2-browser-info

包简介

Browser Information for Yii2

README 文档

README

Latest Stable Version Total Downloads Build Status Dependency Status Scrutinizer Quality Score

Yii2 extension. Provides detailed information about the browser.

Current available providers:

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require alexander-suter/yii2-browser-info "*"

or add

"alexander-suter/yii2-browser-info": "*"

to the require section of your composer.json file.

Usage

This extensions works with a cache in the background. You have to update the cache from time to time.

Create a cronjob and execute following command:

./yii browser-info/update-cache

Use dependency injection to define the concret instance:

Yii::$container->set('asu\browserinfo\BrowserInfo', [
            'class' => 'asu\browserinfo\BrowserInfoBrowscap',
            'memoryLimit' => '512M' 
]);

The Browscap implementation needs much memory to update the cache.

To get browser information in a controller you can now use your DI-Definition:

class SiteController extends Controller {
      private $browserInfo = null;
      public function __construct($id, $module, BrowserInfo $browserInfo, $config = []) {
        $this->browserInfo = $browserInfo;
        parent::__construct($id, $module, $config);
      }
      public function actionIndex() {
        echo $this->browserInfo->getBrowserName();
      }
}

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-05-22