Skip to content
forked from tobie/ua-parser

A multi-language port of Browserscope's user agent parser.

License

Notifications You must be signed in to change notification settings

ankneo/ua-parser

 
 

Repository files navigation

ua-parser Build Status

ua-parser is a multi-language port of BrowserScope's user agent string parser.

The crux of the original parser--the data collected by Steve Souders over the years--has been extracted into a separate YAML file so as to be reusable as is by implementations in other programming languages.

ua-parser is just a small wrapper around this data.

Maintainers

irc channel

#ua-parser on freenode.

Contributing Changes to regexes.yaml

Please read the contributors' guide

Other ua-parser Libraries

There are a few other libraries which make use of ua-parser's patterns. These include:

Usage :: php

require("uaparser.php");

$ua = "Mozilla/5.0 (Macintosh; Intel Ma...";

$parser = new UAParser;
$result = $parser->parse($ua);

print $result->ua->family;                // Safari
print $result->ua->major;                 // 6
print $result->ua->minor;                 // 0
print $result->ua->patch;                 // 2
print $result->ua->toString;              // Safari 6.0.2
print $result->ua->toVersionString;       // 6.0.2

print $result->os->family;                // Mac OS X
print $result->os->major;                 // 10
print $result->os->minor;                 // 7
print $result->os->patch;                 // 5
print $result->os->patch_minor;           // [null]
print $result->os->toString;              // Mac OS X 10.7.5
print $result->os->toVersionString;       // 10.7.5

print $result->device->family;            // Other

print $result->toFullString;              // Safari 6.0.2/Mac OS X 10.7.5
print $result->uaOriginal;                // Mozilla/5.0 (Macintosh; Intel Ma...

More information is available in the README in the PHP directory

License

The data contained in regexes.yaml is Copyright 2009 Google Inc. and available under the Apache License, Version 2.0.

The PHP port is Copyright (c) 2011-2012 Dave Olsen and is available under the MIT license.

About

A multi-language port of Browserscope's user agent parser.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 86.5%
  • PHP 8.5%
  • Perl 4.2%
  • Other 0.8%