php-extended / php-useragentstring-com-api
此包已被弃用且不再维护。作者建议使用php-extended/php-api-com-useragentstring-object 包。
连接到 useragentstring.com API 的 php API 包装器
3.2.7
2021-01-31 22:44 UTC
Requires
- php: >=7.1
- php-extended/php-json-object: ^5
- php-extended/polyfill-php80-stringable: >=1
- psr/http-client: ^1
- psr/http-factory: ^1
README
连接到 useragentstring.com API 的 php API 包装器
安装
此库的安装通过 composer 完成。从他们的网站下载 composer.phar
。然后在 composer.json 中添加:
"require": {
...
"php-extended/php-useragentstring-com-api": "^3",
...
}
然后运行 php composer.phar update
安装此库。此库中所有类的自动加载都通过 composer 的自动加载器完成。
基本用法
您可以按以下方式使用此库
use PhpExtended\UserAgent\UserAgentStringComApiEndpoint;
/* @var $client \Psr\Http\Client\ClientInterface */
/* @var $uriFactory \Psr\Http\Message\UriFactory */
/* @var $requestFactory \Psr\Http\Message\RequestFactory */
/* @var $apiKey string */
$endpoint = new UserAgentStringComApiEndpoint($client, $uriFactory, $requestFactory, $apiKey);
$userAgent = $endpoint->getUserAgent('<put here your user agent string (raw ascii, not encoded)>');
// $userAgent is now a \PhpExtended\UserAgent\UserstackComApiUserAgent
许可证
MIT (见 许可证文件).