Mobile_Detect is an open source PHP class for detecting mobile devices.
It uses the User-Agent string combined with various HTTP headers in order to detect the mobile environment. The class canВ easily understand whether the platform is mobile, tablet or desktop.
Also, functions exist for detecting whether it is iPad, iPhone, Android, Blackberry, etc.
And, we can even drill-down to the versions of the platforms and browsers if needed.
It has a huge library of devices (including Nook, Nexus, Kindle, Archos..) and browsers for a stable detection.