okatsuralau/cakephp-clientinfo
Composer 安装命令:
composer require okatsuralau/cakephp-clientinfo
包简介
CakePHP plugin providing easy access to information about the client app requesting your site
README 文档
README
CakePHP ClientInfo Plugin
This plugin provides easy access to information about the client app requesting your site. It is just a wrapper and uses the Browser Detector library to collect the data.
Requirements
- PHP >= 5.6
- CakePHP >= 3.0
How to Install
composer require okatsuralau/cakephp-clientinfo@1.0.0
How to Use
Load the plugin in your config/bootstrap.php file:
Plugin::load('CakephpClientInfo');
Load the component in your src/Controller/AppController.php
public function initialize() { parent::initialize(); $this->loadComponent('CakephpClientInfo.ClientInfo'); }
To get the info about the client use the
public function index() { // returns the browser name (eg.: Chrome) $this->ClientInfo->browser(); // returns the O.S. name (eg.: Linux) $this->ClientInfo->os(); // returns the Device name (eg.: Computer, Mobile, Tablet, iPhone, ...) $this->ClientInfo->device(); // returns the browser's language (eg.: en) $this->ClientInfo->language(); // or you can access the original instance and make calls directly to the browser-detector $this->ClientInfo->Browser()->getName(); }
More information about the Browser Detector library.
License
Copyright 2017 Gabriel Lau
Available for you to use under the MIT license. See: http://www.opensource.org/licenses/MIT
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-12