The library provides a user agent string
Add dependency mikeevstropov/user-agent
$ composer require mikeevstropov/user-agent
<?php
use Mikeevstropov\UserAgent\UserAgent;
// Getting of a desktop user agent
$desktopUserAgent = UserAgent::getDesktopRand();
gettype($desktopUserAgent); // string
// Getting of a mobile user agent
$mobileUserAgent = UserAgent::getMobileRand();
gettype($mobileUserAgent); // string
-
getDesktopRand
Get a random desktop user agent
Returns:
string
-
getMobileRand
Get a random mobile user agent
Returns:
string
Clone
$ git clone https://github.com/mikeevstropov/user-agent
Go to project
$ cd user-agent
Install dependencies
$ composer install
Run the tests
$ composer test
MIT