Download the PHP package asinka-studio/php-user-agent-generator without Composer
On this page you can find all versions of the php package asinka-studio/php-user-agent-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asinka-studio/php-user-agent-generator
More information about asinka-studio/php-user-agent-generator
Files in asinka-studio/php-user-agent-generator
Package php-user-agent-generator
Short Description PHP User-agent generator
License MIT
Homepage https://github.com/asinka-studio/php-user-agent-generator
Informations about the package php-user-agent-generator
PHP User-Agent Generator
Generate realistic desktop User-Agent strings for modern browsers.
Current Version
- Package version:
0.1.1 - Namespace:
Asinka - Main API:
Asinka\UAGenerator::randomAgent()
Update in 0.1.1
This release adds new functionality on top of previous versions.
- User-Agent generator now supports mobile platforms (
AndroidandiOS). - Added full HTTP headers generator for top-level HTML document navigation.
New headers API (0.1.1)
Update in 0.1.0
1) Updated User-Agent versions and formats
The generator now uses modern UA patterns and version ranges:
Chrome(Chromium-style UA)Edge(Edg/...)Firefox(modernrv+Gecko/20100101format)Safari(macOS Safari format)Opera(OPR/..., Chromium-based)
It also uses current desktop platform tokens:
- Windows 10 style:
Windows NT 10.0; Win64; x64/WOW64 - macOS style:
Mac OS X 13_x,14_x,15_x - Linux style:
X11; Linux x86_64
2) Switched naming from snake_case to camelCase
Public API naming is now camelCase:
- Old:
random_agent(...) - New:
randomAgent(...)
3) Methods are now static
You no longer need to instantiate the class.
-
Old:
- New:
4) Added custom exception
The library now provides and uses its own exception class:
Asinka\Exceptions\UAGeneratorException
The main generator method can throw this exception for invalid or unsupported runtime cases.
Usage
Available Constants
Browsers
UAGenerator::BROWSER_CHROMEUAGenerator::BROWSER_EDGEUAGenerator::BROWSER_FIREFOXUAGenerator::BROWSER_SAFARIUAGenerator::BROWSER_OPERAUAGenerator::BROWSER_IEXPLORER(kept for backward compatibility and mapped to modern Edge behavior)
Operating Systems
UAGenerator::OS_WINDOWSUAGenerator::OS_MACUAGenerator::OS_LINUX
Migration Notes
If you are upgrading from an older version:
- Replace
random_agent(...)withrandomAgent(...). - Replace object calls with static calls:
- from
$generator->randomAgent(...) - to
UAGenerator::randomAgent(...)
- from
- Update exception handling to catch
UAGeneratorExceptionwhere needed.