Documentation
Agent
The user agent class provides a simple way to detect the kind of device that made the request.
Methods
isMobile()
The isMobile
method returns TRUE if the request was made from a mobile device and FALSE it not.
if (Agent::isMobile()) { // Do something... }
isRobot()
The isRobot
method returns TRUE if the request was made by a robot/crawler and FALSE it not.
if (Agent::isRobot()) { // Do something... }
is([mixed $device = null])
The is
method returns TRUE if the word(s) you are looking for are found in the user agent string FALSE it not. It can be used to detect the type of device that was used.
if (Agent::is('iphone')) { // Do something... } if (Agent::is(array('iphone', 'ipod'))) { // Do something... }