pikanji/agent-plugin
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.
pikanji/agent-plugin 适用场景与选型建议
pikanji/agent-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.07k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pikanji/agent-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pikanji/agent-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-26