pikanji/agent-plugin 问题修复 & 功能扩展

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

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

pikanji/agent-plugin

最新稳定版本:1.0.0

Composer 安装命令:

composer require pikanji/agent-plugin

包简介

Detect user's browser, OS, and device from UserAgent. A wrapper plugin of jenssegers/agent.

README 文档

README

日本語版はこちら

OctoberCMS plugin to detect user's browser, OS, and device. This is available not only from PHP but also from Twig templates.

This is a wrapper plugin of jenssegers/agent. Thanks to jenssegers, and also serbanghita created it's base serbanghita/Mobile-Detect.

API

Please refer jenssegers/agent for available APIs.

Usage

Installation

You can install this plugin either via composer or from the backend UI.

With Composer

Execute below at the root of your project.

composer require pikanji/agent-plugin

With OctoberCMS UI

  • Login to OctoberCMS backend
  • Go to Settings > Update & Plugins.
  • Click "Install plugins" button.
  • Search for "Agent", and select it to start installation.

Using in Twig Templates

Agent object will be available after Agent component is added to pages or layouts. I recommend to add the component to your layout, so that you don't have to add every page.

Preparation is to add [Agent] to the configuration section of page or layout files. There is no parameter needed for Agent component.

description = "Default layout"

[Agent]
==
<!DOCTYPE html>
...

Then you can use this Agent object to call jenssegers/agent APIs.

...
{% if Agent.isFireFox() %}
...

Using in PHP Code

Add use Agent;, and call methods from Agent facade.

use Agent;
...

if (Agent::isFireFox()) {
...

If you don't want to use facade, you can use it like this.

use Jenssegers\Agent\Agent;
...

$agent = new Agent();
if ($agent->isFireFox()) {
...

It is just using jenssegers/agent directly. Please refer to its documentation. You don't need to install it since it is installed as the dependency of this plugin.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固