### Install Agent with Composer Source: https://github.com/jenssegers/agent/blob/master/README.md Installs the Jenssegers Agent library using Composer, a dependency manager for PHP. ```bash composer require jenssegers/agent ``` -------------------------------- ### Get Accept Languages Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the list of languages the browser accepts, based on the Accept-Language header. ```php $languages = $agent->languages(); // ['nl-nl', 'nl', 'en-us', 'en'] ``` -------------------------------- ### Get Operating System Name Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the name of the operating system (e.g., Ubuntu, Windows, OS X). ```php $platform = $agent->platform(); ``` -------------------------------- ### Get Robot Name Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the name of the robot if the user agent is identified as a robot. ```php $robot = $agent->robot(); ``` -------------------------------- ### Get Device Name Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the name of the device if it's a mobile device (e.g., iPhone, Nexus, AsusTablet). ```php $device = $agent->device(); ``` -------------------------------- ### Get Browser/Platform Version Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the version number for the detected browser or operating system. Note: This method is in beta and might not always return accurate results. ```php $browser = $agent->browser(); $version = $agent->version($browser); $platform = $agent->platform(); $version = $agent->version($platform); ``` -------------------------------- ### Get Browser Name Source: https://github.com/jenssegers/agent/blob/master/README.md Retrieves the name of the browser (e.g., Chrome, IE, Safari, Firefox). ```php $browser = $agent->browser(); ``` -------------------------------- ### Instantiate Agent Class Source: https://github.com/jenssegers/agent/blob/master/README.md Creates a new instance of the Agent class for parsing user agent information. ```php use Jenssegers\Agent\Agent; $agent = new Agent(); ``` -------------------------------- ### Use Magic is-Methods Source: https://github.com/jenssegers/agent/blob/master/README.md Utilizes magic methods for a more concise way to check user agent properties. ```php $agent->isAndroidOS(); $agent->isNexus(); $agent->isSafari(); ``` -------------------------------- ### Check User Agent Properties Source: https://github.com/jenssegers/agent/blob/master/README.md Checks if the user agent matches specific properties like operating system, browser, or device. ```php $agent->is('Windows'); $agent->is('Firefox'); $agent->is('iPhone'); $agent->is('OS X'); ``` -------------------------------- ### Set User Agent and HTTP Headers Source: https://github.com/jenssegers/agent/blob/master/README.md Manually sets the user agent string and HTTP headers for parsing in CLI scripts or other non-request contexts. ```php $agent->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2'); $agent->setHttpHeaders($headers); ``` -------------------------------- ### Match User Agent with Regular Expression Source: https://github.com/jenssegers/agent/blob/master/README.md Searches the user agent string using a provided regular expression pattern. ```php $agent->match('regexp'); ``` -------------------------------- ### Detect Desktop Devices Source: https://github.com/jenssegers/agent/blob/master/README.md Checks if the user agent indicates a desktop device. This is determined by checking if it's not a mobile, tablet, or robot. ```php $agent->isDesktop(); ``` -------------------------------- ### Register Agent Service Provider in Laravel Source: https://github.com/jenssegers/agent/blob/master/README.md Registers the AgentServiceProvider in the Laravel application's configuration file to enable the library's functionality. ```php Jenssegers\Agent\AgentServiceProvider::class, ``` -------------------------------- ### Add Agent Facade Alias in Laravel Source: https://github.com/jenssegers/agent/blob/master/README.md Adds an alias for the Agent facade in the Laravel application's configuration file for convenient access. ```php 'Agent' => Jenssegers\Agent\Facades\Agent::class, ``` -------------------------------- ### Detect Phone Devices Source: https://github.com/jenssegers/agent/blob/master/README.md Checks if the user agent indicates a phone device. ```php $agent->isPhone(); ``` -------------------------------- ### Detect Robots Source: https://github.com/jenssegers/agent/blob/master/README.md Checks if the user agent belongs to a known web robot or crawler. This utilizes the 'jaybizzle/crawler-detect' library. ```php $agent->isRobot(); ``` -------------------------------- ### Detect Mobile and Tablet Devices Source: https://github.com/jenssegers/agent/blob/master/README.md Checks if the user agent belongs to a mobile phone or a tablet device. ```php $agent->isMobile(); $agent->isTablet(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.