Skip to content

ymgsmz/UserAgentParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UserAgentParser

Build Status

User agent parser for Laravel.

Installation

Install via composer:

$ composer require zarei/user-agent-parser

Initialize in Laravel

  • Add the service provider to provider section in config/app.php:
Zarei\UserAgentParser\UserAgentServiceProvider::class,
  • Add the alias of User-Agent to aliases section in config/app.php:
'UserAgentParser' =>  \Zarei\UserAgentParser\Facades\UserAgentParser::class,

Usage

Parse any User-Agent:

$parsed = UserAgentParser::parse(request()->userAgent());

And attend to the table below for finding out how to access parsed data:

Entity Getter Properties Sample Result
Device $parsed->device() ->vendor
->model
->type
Xiaomi
Mi 5X
mobile
CPU $parsed->cpu() ->architecture arm
OS $parsed->os() ->name
->version
->major
Android
8.1.0
8
Browser $parsed->browser() ->name
->version
->major
Chrome
74.0.3729.169
74
Engine $parsed->engine() ->name
->version
->major
Webkit
604.3.5
604

About

User agent parser for Laravel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages