martinbean/dribbble-php

此包已被废弃,不再维护。未建议替代包。

为 Dribbble API 提供的 PHP 封装。

4.0.0 2016-01-29 16:41 UTC

This package is not auto-updated.

Last update: 2020-01-16 23:12:09 UTC


README

安装

$ composer require "martinbean/dribbble-php=4.*"

使用

实例化客户端

$client = new Dribbble\Client;

如果您有,设置访问令牌

$client->setAccessToken('Your access token');

Dribbble API 执行请求

try {
    $response = $client->makeRequest('/user', 'GET');
} catch (Exception $e) {
    print $e->getMessage();
}

客户端将返回一个 对象,或者抛出以下异常之一

  • Dribbble\Exception\BadRequestException
  • Dribbble\Exception\TooManyRequestsException
  • Dribbble\Exception\UnauthorizedException
  • Dribbble\Exception\UnprocessableEntityException

Dribbble API 有速率限制。如果您超过限制,将抛出 TooManyRequestsException

如果您尝试访问需要身份验证的 URI 而没有提供访问令牌,则将抛出 UnauthorizedException

UnprocessableEntityException 指的是验证错误。您可以通过类上的 getErrors() 方法获取失败的验证规则数组

try {
    // Make request with data that fails validation
} catch (UnprocessableEntityException $e) {
    $errors = $e->getErrors();
}

许可证

MIT 许可证 下授权。

问题

请报告至:https://github.com/martinbean/dribbble-php/issues