rypsx / infomaniak
一个用于使用Infomaniak API的PHP工具
3.1
2016-09-24 14:28 UTC
Requires
- php: >=5.4.0
- nesbot/carbon: ^1.21
- rypsx/ipapi: ^1.0
This package is auto-updated.
Last update: 2024-09-21 23:48:06 UTC
README
访问英文版本
此包允许您将托管在Infomaniak上的流的统计信息集成到您的项目中。
介绍
此包允许您拥有
- 音频流的当前状态
- 当前听众数量以及最大数量
- 实时听众详情(+ 新参数可按播放时长排序)
- 正在收听的听众的位置信息(新功能)
使用方法
要求
- PHP5
- Carbon
- Rypsx\IpApi
Composer
如果您使用 Composer,您可以在终端中输入以下命令来添加此包
composer require rypsx/infomaniak
或者编辑 composer.json
文件,如下所示
{
"require": {
"rypsx/infomaniak": "^3.1"
}
输出示例
版本 2
- 修正通过Composer的集成。现在项目可以直接使用命名空间使用
- 可以按播放时长对当前听众进行分类。类调用的最后一个参数
- 扩展类以支持其他编解码器和比特率类型
- 其他修复
版本 3.0
- 修复错误
- 添加IpApi类以获取听众的位置信息(可选)
版本 3.1
- 添加一个“Lite”类,可以仅获取基本信息
英文版本
此包允许您将Infomaniak托管的流的统计信息集成到您的项目中。
介绍
此包允许您拥有
- 音频流的当前状态
- 实时听众数量和最大数量
- 实时听众的详细信息(+ 新参数可按播放时长排序或不清除)
- 正在收听的听众的位置信息(新功能)
使用示例 / 使用方法
<?php use Rypsx\Infomaniak\Infomaniak; require __DIR__ . '/../vendor/autoload.php'; try { /** * `login` is the username you are using on Infomaniak admin * `passwd` is the password you are using on Infomaniak admin * `rate` is the rate you want select. Eg : 128 / 96 / 64 or string like low / high, etc. * `codec` is the type of codec you want to select. Eg : mp3 / aac, etc. * `sorted` This parameter MUST be set to true or false. By setting true, * it allow you to sort current listener by decreasing playing time. DEFAULT FALSE * `ipapi` This parameter MUST be set to true or false. By setting true, * it allow you to get geographic informations about your listeners. * This API allows only 150 queries per minute, so a module is set up to prevent * any query exceeds the 150th. DEFAULT FALSE */ // Getting only Flux state, Live stats & current listeners informations // $im = new Infomaniak(`login`, `passwd`, `128`, `mp3`); // Getting all informations :: TYPICALLY EXAMPLE for version 3 $im = new Infomaniak(`login`, `passwd`, 128, `mp3`, true, true); // Get info about geolocation of current listeners /* foreach ($im->current as $num => $current) { var_dump($current->ipApi); } */ } catch (\Exception $e) { print $e->getMessage(); } var_dump($im); ?>
要求
- PHP5
- Carbon
- Rypsx\IpApi
Composer
如果您使用 Composer,您可以在终端中输入以下命令来添加此包
composer require rypsx/infomaniak
或者通过编辑 composer.json
文件,如下所示
{
"require": {
"rypsx/infomaniak": "^3.1"
}
输出示例 / 输出示例
object(Rypsx\Infomaniak\Infomaniak)[3] protected 'login' => string '****' (length=12) protected 'passwd' => string '****' (length=8) protected 'rate' => string '128' (length=3) protected 'codec' => string 'mp3' (length=3) public 'erreur' => null public 'updateDate' => string '2016-09-18 13:39:14' (length=19) public 'flux' => object(Rypsx\Infomaniak\FluxState)[2] public 'principal' => string 'UP' (length=2) public 'backup' => string 'UP' (length=2) public 'live' => object(Rypsx\Infomaniak\LiveStats)[5] public 'peak' => int 154 public 'current' => int 6 public 'current' => array (size=6) 27020 => object(Rypsx\Infomaniak\CurrentListeners)[36] public 'ip' => string '****' (length=13) public 'dureeEcoute' => string '8 heures' (length=8) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[34] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=13) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[18] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'United States' (length=13) public 'paysCode' => string 'US' (length=2) public 'region' => string '****' (length=8) public 'ville' => string '****' (length=7) public 'cp' => string '****' (length=5) public 'latitude' => string '****' (length=7) public 'longitude' => string '****' (length=8) public 'timezone' => string 'America/Chicago' (length=15) public 'isp' => string '****' (length=13) 8535 => object(Rypsx\Infomaniak\CurrentListeners)[39] public 'ip' => string '****' (length=11) public 'dureeEcoute' => string '2 heures' (length=8) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[37] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=11) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[27] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'Germany' (length=7) public 'paysCode' => string 'DE' (length=2) public 'region' => string '****' (length=7) public 'ville' => string '****' (length=9) public 'cp' => string '' (length=0) public 'latitude' => string '****' (length=6) public 'longitude' => string '****' (length=7) public 'timezone' => string 'Europe/Berlin' (length=13) public 'isp' => string '****' (length=19) 6914 => object(Rypsx\Infomaniak\CurrentListeners)[30] public 'ip' => string '****' (length=11) public 'dureeEcoute' => string '2 heures' (length=8) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[7] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=11) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[21] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'France' (length=6) public 'paysCode' => string 'FR' (length=2) public 'region' => string '****' (length=17) public 'ville' => string '****' (length=17) public 'cp' => string '****' (length=5) public 'latitude' => string '****' (length=7) public 'longitude' => string '****' (length=7) public 'timezone' => string 'Europe/Paris' (length=12) public 'isp' => string '****' (length=3) 4605 => object(Rypsx\Infomaniak\CurrentListeners)[42] public 'ip' => string '****' (length=13) public 'dureeEcoute' => string '1 heure' (length=7) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[40] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=13) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[12] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'France' (length=6) public 'paysCode' => string 'FR' (length=2) public 'region' => string '****' (length=14) public 'ville' => string '****' (length=5) public 'cp' => string '****' (length=5) public 'latitude' => string '****' (length=7) public 'longitude' => string '****' (length=6) public 'timezone' => string 'Europe/Paris' (length=12) public 'isp' => string '****' (length=6) 2105 => object(Rypsx\Infomaniak\CurrentListeners)[10] public 'ip' => string '****' (length=13) public 'dureeEcoute' => string '35 min' (length=6) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[4] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=13) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[11] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'France' (length=6) public 'paysCode' => string 'FR' (length=2) public 'region' => string '****' (length=17) public 'ville' => string '****' (length=9) public 'cp' => string '****' (length=5) public 'latitude' => string '****' (length=7) public 'longitude' => string '****' (length=7) public 'timezone' => string 'Europe/Paris' (length=12) public 'isp' => string '****' (length=8) 467 => object(Rypsx\Infomaniak\CurrentListeners)[33] public 'ip' => string '****' (length=13) public 'dureeEcoute' => string '8 min' (length=5) public 'ipApi' => object(Rypsx\Ipapi\Ipapi)[31] public 'erreur' => null public 'date' => string '2016-09-18 13:39:40' (length=19) public 'ipAdr' => string '****' (length=13) public 'ip2long' => int **** public 'ipapi' => object(Rypsx\Ipapi\IpRequest)[15] public 'erreur' => array (size=0) empty public 'status' => string 'success' (length=7) public 'pays' => string 'France' (length=6) public 'paysCode' => string 'FR' (length=2) public 'region' => string '****' (length=14) public 'ville' => string '****' (length=26) public 'cp' => string '****' (length=5) public 'latitude' => string '****' (length=7) public 'longitude' => string '****' (length=6) public 'timezone' => string 'Europe/Paris' (length=12) public 'isp' => string '****' (length=8) private 'counterIpApi' => int 6
感谢您注意,以上示例中如IP地址或位置信息等敏感信息被故意用 ****
隐藏,因为这是一个实际测试的结果
版本 2
- 通过Composer进行集成修正。现在项目可以通过使用命名空间直接使用
- 可以按播放时长对当前听众进行分类。类调用的最后一个参数
- 扩展类以支持其他编解码器和比特率类型
- 其他修复
版本 3.0
- 错误修复
- 添加IPAPI类以获取听众的位置信息(可选)
版本 3.1
- 添加“Lite”类以仅获取必要信息
许可证
MIT许可证(MIT)
版权所有 (c) 2016 Rypsx Dev
在此特此授予任何获得本软件及其相关文档文件(以下简称“软件”)副本的个人免费使用软件的权利,不受限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、许可和/或出售软件副本,并允许向软件提供者提供软件的人进行上述操作,前提是遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“现状”提供,不提供任何形式的保证,无论是明示的还是暗示的,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论该责任是由于合同、侵权或其他原因引起的,也不论该责任是否与软件或软件的使用或其他操作有关。