PHP Classes
elePHPant
Icontem

PHP Browser OS Detection and Age Guessing: Estimate the age of the browser and OS it runs on

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-06-26 (19 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 215 This week: 2All time: 7,981 This week: 211Up
Version License PHP version Categories
software-age-gauge 1.0.4Custom (specified...5HTTP, PHP 5, Parsers
Description Author

This class can estimate the age of the browser and OS it runs on.

It can check the name of the current browser accessing a site and parses it to determines the browser type, version number and operating system type.

The class can look up a list of known browsers and operating systems make educated guess of the browser age based on the version number.

Innovation Award
PHP Programming Innovation award winner
April 2018
Winner
Some sites require that the users use a more recent browser that is not older than a certain age and works on certain operation systems that are well supported.

This package can guess check the identification of a user browser sent via HTTP requests and detect what is the age of the version of the browser that is being used, as well the operation system that it is running.

Manuel Lemos
  Performance   Level  
Name: Peter Kahl <contact>
Classes: 34 packages by
Country: United Kingdom United Kingdom
Age: ???
All time rank: 58630 in United Kingdom United Kingdom
Week rank: 13 Up1 in United Kingdom United Kingdom Up
Innovation award
Innovation award
Nominee: 20x

Winner: 1x

Details

Version To Age

Downloads License If this project has business value for you then don't hesitate to support me with a small donation.

Software age gauge. Estimates age of browser and OS software. The script stores an associative array of software names and version and timestamp pairs. It also periodically connects to external servers to fetch the latest information on Firefox and Chrome browsers.

image

Limitations

This script knows only that which is stored in its data array.

Browsers: * chrome * crios * edge * explorer * firefox * lunascape * maxthon * safari * mobile safari * netsurf * opera * samsungbrowser * seamonkey

Operating Systems: * android * ios * macos * windows

Usage

use peterkahl\Version2age\Version2age;

$v2a = new Version2age;

# Location of CA certificate file
# You may download and install on your server this Mozilla CA bundle
# from this page: <https://curl.haxx.se/docs/caextract.html>
$v2a->CAbundle = '/srv/certs/ca-bundle.pem';

# Location of your cache directory
$v2a->CacheDir = '/srv/cache';

# Perhaps you have user agent string like this
# $user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) CriOS/65.0.3325.152 Mobile/15E5216a Safari/604.1';
# I have used this parser at <https://github.com/peterkahl/user-agent-parser>
# to parse the above string down to
$os_name = 'iOS'; # case insensitive
$os_vers = '11.3';

$age = $v2a->GetAge($os_name, $os_vers);
$age = $age/31536000; # years

if (is_string($age) && $age == 'UNKNOWN') {
  echo 'I\'m sorry. I don\'t know this software.'
}
elseif ($age >= 1) {
  echo 'Your software is 1 year old or older.';
}

Crontab Job to keep up-to-date

Run the script below every 6 hours. This forces connection to external servers in order to fetch the most up-to-date data on Firefox and Chrome browsers.

use peterkahl\Version2age\Version2age;

# Location of CA certificate file
# You may download and install on your server this Mozilla CA bundle
# from this page: <https://curl.haxx.se/docs/caextract.html>
$v2a->CAbundle = '/srv/certs/ca-bundle.pem';

# Location of your cache directory
$v2a->CacheDir = '/srv/cache';

$v2a->Initialise(true);

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Image file screen-shot.png Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file data.json Data Auxiliary data
  Plain text file Version2age.php Class Class source

Downloadsoftware-age-gauge-2018-06-26.zip 485KB
Downloadsoftware-age-gauge-2018-06-26.tar.gz 485KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
curl Master Download .zip .tar.gz Make HTTP connection Required
 Version Control Unique User Downloads Download Rankings  
 100%
Total:215
This week:2
All time:7,981
This week:211Up