tp/guzzle-dawanda

此包已被放弃,不再维护。没有建议的替代包。

DaWanda API 的 Guzzle 实现

v0.1.0-beta 2012-12-09 14:11 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:22:38 UTC


README

Build Status

这是 DaWanda API v1 的基本 Guzzle 实现。目前只实现了基本 API,我正在扩展更多功能和编写 OAuth 提供程序。

安装

Composer

在你的 composer.json 中需要以下包

require: {
    ...
    "tp/guzzle-dawanda": "dev-master",
    ...
}

在 DaWanda 获取 API 密钥

在这里获取: http://www.dawanda.com/apps

使用方法

目前 DaWanda 支持 3 种语言,'de', 'en' 和 'fr'。

<?php
use Guzzle\DaWanda\DaWandaClient;

// Get the client using the factory
$client = DaWandaClient::factory(array(
    'language' => 'en', // default
    'api_key'  => '******', // Your API key here
    'format'   => 'json' // or 'xml'
));

// Use the client
$result = $client->SearchUsers(array(
    'keyword'  => 'Liebe-und-Kraft'
));

// Pagination
$result = $client->SearchUsers(array(
    'keyword'  => 'Liebe-und-Kraft',
    'per_page' => 30, // default is 10
    'page'     => 3   // Third page, default is 1
));

查看所有支持的方法: https://github.com/tPl0ch/guzzle-dawanda/blob/master/src/DaWanda/DaWanda.json

待办事项

  • 添加 ResourceIterator 以简化分页处理
  • 添加模型以便更愉快地重用结果对象
  • 增加测试覆盖率

进一步阅读

guzzle 的文档也非常有信息量,所以请查看: http://guzzlephp.org/docs.html