https://github.com/elusivecodes/fyreuseragent
FyreUserAgent is a free, open-source user agent library for PHP.
https://github.com/elusivecodes/fyreuseragent
php user-agent
Last synced: 7 months ago
JSON representation
FyreUserAgent is a free, open-source user agent library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyreuseragent
- Owner: elusivecodes
- License: mit
- Created: 2021-12-03T10:13:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-27T11:12:59.000Z (8 months ago)
- Last Synced: 2024-10-27T12:31:00.693Z (8 months ago)
- Topics: php, user-agent
- Language: PHP
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreUserAgent
**FyreUserAgent** is a free, open-source user agent library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)## Installation
**Using Composer**
```
composer require fyre/useragent
```In PHP:
```php
use Fyre\Http\UserAgent;
```## Basic Usage
- `$agent` is a string representing the user agent.
```php
$userAgent = new UserAgent($agent);
```Alternatively, you can use the `fromString` method for easier chaining.
```php
$userAgent = UserAgent::fromString($agent);
```## Methods
**Get Agent String**
Get the user agent string.
```php
$agent = $userAgent->getAgentString();
```**Get Browser**
Get the browser.
```php
$browser = $userAgent->getBrowser();
```**Get Mobile**
Get the mobile.
```php
$mobile = $userAgent->getMobile();
```**Get Platform**
Get the platform.
```php
$platform = $userAgent->getPlatform();
```**Get Robot**
Get the robot.
```php
$robot = $userAgent->getRobot();
```**Get Version**
Get the browser version.
```php
$version = $userAgent->getVersion();
```**Is Browser**
Determine whether the user agent is a browser.
```php
$isBrowser = $userAgent->isBrowser();
```**Is Mobile**
Determine whether the user agent is a mobile.
```php
$isMobile = $userAgent->isMobile();
```**Is Robot**
Determine whether the user agent is a robot.
```php
$isRobot = $userAgent->isRobot();
```