GithubHelp home page GithubHelp logo

oldbayindustries / flamework-useragent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iamcal/flamework-useragent

0.0 2.0 0.0 144 KB

A Flamework library for decoding User Agent strings

PHP 100.00%

flamework-useragent's Introduction

A Flamework library for decoding User Agent strings

This library is designed to be used with Flamework, but works standalone too.

Usage:

# single shot
$ret = useragent_decode($ua);

# when decoding in batches
$ret = useragent_decode_cached($ua);

# return structure
$ret = array(
  'agent'          => 'chrome',
  'agent_version'  => '15.0.874.121',
  'engine'         => 'webkit',
  'engine_version' => '535.2',
  'os'             => 'osx',
  'os_version'     => '10.7.2',
);

Possible values

agent will be one of the following, with the full version number in agent_version:

  • chrome
  • safari
  • firefox
  • msie
  • dalvik (android VM, not actually the browser)
  • opera
  • netscape
  • konqueror
  • blackberry (pre-safari)

engine contains the rendering engine, with the full version number in engine_version:

  • webkit
  • gecko
  • trident
  • presto

os and os_version contain the platform, with the following values:

  • osx/n.n(.n)
  • iphone/n.n(.n)
  • ipad/n.n(.n)
  • ipod/n.n(.n)
  • windows/xp
  • windows/xp-x64
  • windows/vista
  • windows/7
  • linux/i686
  • linux/x86_64
  • android/n.n(.n)
  • blackberry/$model

When a field does not match one of the known values, it will be set to null.

Caveats

  • Not all browsers, rendering engines and platforms are supported - this is by design! Only common agents are included.
  • We just return "linux/i686" rather than e.g. "Ubuntu", since most Linux flavors don't give distro, plus nobody cares.
  • Chromium returns "chrome" - same thing anyway, plus it has a different version number.
  • We differentiate iPad, iPhone and iPod, even though they are the same OS. You can easily patch this locally if you don't need to know.

flamework-useragent's People

Contributors

iamcal avatar alirayl avatar jacques avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.