Jenssegers\Agent\Agent::robot PHP Method

robot() public method

Get the robot name.
public robot ( string $userAgent = null ) : string
$userAgent string
return string
    public function robot($userAgent = null)
    {
        // Get bot rules
        $rules = $this->mergeRules(static::$robots, array(static::$utilities['Bot']), array(static::$utilities['MobileBot']));
        return $this->findDetectionRulesAgainstUA($rules, $userAgent);
    }

Usage Example

Example #1
0
 public function getUA()
 {
     // Initialize UA
     $agent = new Agent();
     $browser = $agent->browser();
     // Assemble data
     $data = ['browser' => $browser, 'browser_version' => $agent->version($browser), 'languages' => array($agent->languages()), 'device' => $agent->device(), 'platform' => $agent->platform(), 'is_mobile' => $agent->isMobile(), 'is_tablet' => $agent->isTablet(), 'is_desktop' => $agent->isDesktop(), 'is_robot' => $agent->isRobot(), 'robot_name' => $agent->robot()];
     return $data;
 }
All Usage Examples Of Jenssegers\Agent\Agent::robot