PHP code example of trgino / random-user-agent

1. Go to this page and download the library: Download trgino/random-user-agent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

trgino / random-user-agent example snippets


namespace RandomAgent;
:random();

/* or */

$rand_ua = Random_UA::random([
	'category' => 'desktop',
]);

/* or */

$rand_ua = Random_UA::random([
	'category' => ['desktop'],
]);

/* or */

$rand_ua = Random_UA::random([
	'category' => ['desktop'],
	'platform' => ['windows','mac'],
]);


namespace RandomAgent;
tCategories());
/*
Array
(
    [0] => desktop
)
*/

namespace RandomAgent;
tPlatforms());

/*
Array
(
    [0] => Windows
    [1] => Mac
)
*/