dev-master
9999999-devDetect user's browser, OS, and device from UserAgent. A wrapper plugin of jenssegers/agent.
MIT
The Requires
by Kanji Furuhashi
Detect user's browser, OS, and device from UserAgent. A wrapper plugin of jenssegers/agent.
日本語版はこちら, (*1)
OctoberCMS plugin to detect user's browser, OS, and device. This is available not only from PHP but also from Twig templates., (*2)
This is a wrapper plugin of jenssegers/agent. Thanks to jenssegers, and also serbanghita created it's base serbanghita/Mobile-Detect., (*3)
Please refer jenssegers/agent for available APIs., (*4)
You can install this plugin either via composer or from the backend UI., (*5)
Execute below at the root of your project., (*6)
composer require pikanji/agent-plugin
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., (*7)
Preparation is to add [Agent]
to the configuration section of page or layout files. There is no parameter needed for Agent component., (*8)
description = "Default layout" [Agent] == <!DOCTYPE html> ...
Then you can use this Agent object to call jenssegers/agent APIs., (*9)
... {% if Agent.isFireFox() %} ...
Add use Agent;
, and call methods from Agent
facade., (*10)
use Agent; ... if (Agent::isFireFox()) { ...
If you don't want to use facade, you can use it like this., (*11)
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., (*12)
Detect user's browser, OS, and device from UserAgent. A wrapper plugin of jenssegers/agent.
MIT