Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trgino/random-ua
https://github.com/trgino/random-ua
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/trgino/random-ua
- Owner: trgino
- License: mit
- Created: 2022-05-08T12:49:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T19:04:12.000Z (about 2 years ago)
- Last Synced: 2024-12-08T13:48:17.773Z (30 days ago)
- Language: PHP
- Size: 176 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Random user agent generator in PHP
=============================[![Packagist](https://img.shields.io/packagist/dt/trgino/random-user-agent.svg)](https://packagist.org/packages/trgino/random-user-agent)
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://php.net/)Installation
-----To install `Random_UA` you can either clone this repository or you can use composer
```bash
composer require trgino/random-user-agent
```Usage
-----
```php
namespace RandomAgent;
require_once __DIR__.'/vendor/autoload.php';$rand_ua = Random_UA::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'],
]);```
/* or */
$rand_ua = Random_UA::random([
'category' => ['desktop'],
'platform' => ['windows','mac'],
'vendor' => ['chrome'],
]);```
Available Device Categories
-----
```php
namespace RandomAgent;
require_once __DIR__.'/vendor/autoload.php';print_r(Random_UA::getCategories());
/*
Array
(
[0] => desktop
)
*/
```Available Platforms
-----
```php
namespace RandomAgent;
require_once __DIR__.'/vendor/autoload.php';print_r(Random_UA::getPlatforms());
/*
Array
(
[0] => Windows
[1] => Mac
)
*/
```