bananatag/bananatag-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bananatag/bananatag-api-php

最新稳定版本:0.1.0

Composer 安装命令:

composer require bananatag/bananatag-api-php

包简介

The Bananatag API PHP Library is used in conjunction with Bananatag's REST API (currently in alpha, available on request only). The Bananatag REST API allows users access to all data associated with their account and sub-accounts.

README 文档

README

The Bananatag API PHP Library is used in conjunction Bananatag's REST API (currently in alpha, available on request only). The Bananatag REST API allows users access to all data associated with their account and sub-accounts.

Installation

Composer

"require": {
    "bananatag/bananatag-api-php": "dev-master"
}

Not using composer yet, get composer here.

Requires

  • PHP 5.3+
  • CURL 7.30.0+.

Basic Usage

Get All Tags

<?php
    use Bananatag\Api;
    
    // Create Api class instance
    $btag = new Api('AuthID', 'Access Key');
	
    // Make request for all tags in date range
	$results = $btag->request("tags", ['start'=>'2015-01-01', 'end'=>'2015-02-01']);
	
    // Print list of tags
    echo "Total Tags: " . count($results['data']) . "<br><hr><br>";
    
    print_r($results['data']);
    

Pagination

Each time you make a request with the same parameters, the library automatically grabs the next page.

<?php
$btag = new Api('AuthID', 'Access Key');

function getTags(&$btag) {
    $results = $btag->request("tags", []);

    echo $results['paging']['cursors']['next'];

    if ($results['paging']['cursors']['next'] < $results['paging']['cursors']['total']) {
        sleep(1.2);
        getTags($btag);
    }
}

getTags($btag);

The recursive example above could be written:

<?php
// Page 1
$results = $btag->request("tags", []);
// Page 2
$results = $btag->request("tags", []);
// Page 3, etc
$results = $btag->request("tags", []);

Or you can manually choose a page:

<?php
// Page 1
$results = $btag->request("tags", ['page'=>1]);
// Page 3
$results = $btag->request("tags", ['page'=>3]);
// Page 2
$results = $btag->request("tags", ['page'=>2]);

Request Limit

The API is limited to 1 request per second.

License

Licensed under the MIT License.

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 14
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-30