godsdev/default-device-connector
Composer 安装命令:
composer require godsdev/default-device-connector
包简介
PHP connector to default device service
README 文档
README
PHP connector for defauldevice service
For security (not revealing files that SHOULD NOT be accessed through browser) mod_alias.c SHOULD be enabled in the directory where this library lives.
Usage:
$deviceInfo = new GodsDev\DefaultDeviceConnector\DefaultDeviceConnector(); //may be initiated with non default latest API URL var_dump($deviceInfo->request()); var_dump($deviceInfo->getMarkup());
Method request()
Returns either array with device properties (and sets $deviceInfo->properties to the same value) or returns false and puts details into $deviceInfo->error
Note: workaround before default device API can process it directly: 'Device-Stock-UA' takes precedence before 'X-OperaMini-Phone-UA' takes precedence before 'HTTP_USER_AGENT'.
Method getMarkup()
Returns one of strings
- html5 (which is default even in case of API call error)
- desktop
- xhtml
Method setCharacteristics(array $characteristics)
Sets arbitrarily the values to request the default device API with.
'user_agent' key MUST be present.
'x-wap-profile', 'accept', 'x-operamini-phone-ua', 'device-stock-ua' keys MAY be present.
Method defaultCharacteristics()
Populates the values to request the default device API with according to the current HTTP headers.
Is called automatically by the __constructor.
统计信息
- 总下载量: 226
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-02-11