Giter Site home page Giter Site logo

dribbble-php's Introduction

PHP Wrapper for Dribbble API

Installation

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

Usage

Instantiate the client:

$client = new Dribbble\Client;

Set the access token if you have one:

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

Perform requests against Dribbble’s API:

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

The client will either return an object, or throw one of the following exceptions:

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

Dribbble’s API is rate-limited. If you exceed the limit, a TooManyRequestsException will be raised.

If you try to access a URI that requires authentication and you haven’t supplied an access token, then a UnauthorizedException will be raised.

UnprocessableEntityException refers to a validation error. You can fetch an array of the failed validation rules with the getErrors() method on the class:

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

License

Licensed under the MIT License.

Issues

Please report to: https://github.com/martinbean/dribbble-php/issues

dribbble-php's People

Contributors

martinbean avatar raray avatar zachdunn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dribbble-php's Issues

Pagination parameters?

Hey Martin,

Pagination paramaters don't seem to work in v2. The options seem to be getting lost in the makeRequest function.

I was able to fix it by adding them to the url in makeRequest:

$url = $url.'/?'.http_build_query($options);

There's probably a better way to do this, but I don't know enough about curl.

Unknown variable $id for function "get_shots_list"

For function get_shots_list there is a error

Notice: Undefined variable: id in ...\dribbble-php\src\Dribbble.php on line 78

Here 3rd parameter need to set null

Here is the fix
//return $this->makeRequest(sprintf('/shots/%s'.$list, $id), 'GET', $options);
return $this->makeRequest(sprintf('/shots/%s'.$list, ''), 'GET', $options);

The result will be , ie the modified function will be

/**
* Returns the specified list of shots.
*
* @param string $list
* @param integer $page
* @param integer $per_page
* @return object
*/
public function get_shots_list($list = 'everyone', $page = 1, $per_page = 15)
{
$options = array('page' => intval($page), 'per_page' => intval($per_page));
//return $this->makeRequest(sprintf('/shots/%s'.$list, $id), 'GET', $options);
return $this->makeRequest(sprintf('/shots/%s'.$list, ''), 'GET', $options);
}

BTW, we are developing an extension using this api and will share when we done.

Thanks.

Search Keyword Term

Hi there,

I'm messing around with your library and was hoping you could help me figure out how to output a keyword? e.g., search for a keyword across the site and output results for "term".

Right now all I can do is search specific usernames and return those shots.

Thanks in advance.

Add support for parameters

Clients allows the making of simple URI-based requests. Need to add parameter support so users can send data, paginate etc.

Fatal error: Cannot redeclare class...

Fatal error: Cannot redeclare class DribbbleException in /nfs/c09/h01/mnt/129375/domains/bjuneau.com/html/includes/src/dribbble.php on line 22

I keep getting this error with the new php file. I followed your documentation word for word. I looked in the dribbble.php and don't see more than one class so I'm not sure why it's saying "cannot re-declare class"? Also, the dribbble feed is only included once in the footer. Any ideas? Thanks for the help, Martin.

Oh, I am using MediaTemple hosting too.

Problem with my server?

Hello, I am having trouble. Is there a way to check my sever and see if it has the required software/settings? I know it has PHP. I have gotten your code to work on a sever, but when I moved it to another sever it failed, even after checking links. Also, the source files for the project don’t work on this new server. I think the server is the problem.

Here is the error showing up in the source files for this project:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 32

Warning: file_get_contents(http://api.dribbble.com//shots/popular?page=1&per_page=3) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 32

Warning: Invalid argument supplied for foreach() in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 33

Warning: Invalid argument supplied for foreach() in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/examples/general.php on line 34

Upgrade to new dribbble api

any plans in the works to upgrade this for the new api?

just realized my feed broke today after they shut down endpoints for the beta api. oops!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.