https://github.com/zencephalon/useragent
Translation of useragent into PHP
https://github.com/zencephalon/useragent
Last synced: over 1 year ago
JSON representation
Translation of useragent into PHP
- Host: GitHub
- URL: https://github.com/zencephalon/useragent
- Owner: zencephalon
- License: mit
- Created: 2013-02-01T21:33:41.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-25T16:13:59.000Z (over 13 years ago)
- Last Synced: 2025-01-16T21:42:12.202Z (over 1 year ago)
- Language: PHP
- Size: 170 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Sail\UserAgent
Install with composer:
``` json
{
"require": {
"sail/useragent": "1.0.*"
},
"repositories": [{
"type": "vcs",
"url": "https://github.com/zencephalon/useragent"
}]
}
```
create an index.php file:
``` php
$test----------------------------
";
$parser = new SailParser( $useragent );
$ua = new UserAgent( $parser );
echo $ua;
echo "
";
echo "
Browser: ";
echo $ua->getBrowser();
echo " v";
echo $ua->getVersion();
echo "
Is mobile: ";
echo $ua->isMobile() ? "YES" : "NO";
echo "
";
if( $ua->getBrowser() == "MSIE" && $ua->getVersion() < 8 ){
echo "browser not supported";
}
else{
echo "browser supported";
}
echo "
is internet explorer 8 ";
if( $ua->getBrowser() == "Internet Explorer" && preg_match( "/^8/", $ua->getVersion() ) ){
echo "YES";
}
else{
echo "NO";
}
}
```