jenssegers/agent
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
jaybizzle/crawler-detect | v1.2.118 | - | MIT | prod | |
mobiledetect/mobiledetectlib | 2.8.45 | 167.84 kB | MIT | prod |
The jenssegers/agent PHP package is a user agent parser for desktop and mobile devices. This package is perfectly compatible with Laravel and builds upon the Mobile Detect library. Its main function is to help PHP developers identify the client's device, browser, platform, and language preferences. Additionally, it provides features to detect whether the client is a desktop, a phone, a robot, or even a tablet.
To start using the jenssegers/agent PHP package, first, you need to install it using composer. Here is how you can do it:
composer require jenssegers/agent
After installing, you can start using it like this:
use Jenssegers\Agent\Agent;
$agent = new Agent();
You can check for device-specific properties in the user agent like this:
$agent->is('Windows');
$agent->is('Firefox');
$agent->is('iPhone');
$agent->is('OS X');
You have the flexibility to use numerous other methods provided by the Mobile Detect library. Additionally, you can use some handy methods provided by jenssegers/agent like isDesktop()
for desktop device detection, isRobot()
for robot detection, browser()
for retrieving the browser name, etc.
The comprehensive documentation for the jenssegers/agent PHP package isn't hosted separately. The entire usage guide and method reference can be found on its GitHub repository's README page. Here is the url: https://github.com/jenssegers/agent. You can find extensive details about all the available methods and their usage on this page.