Giter Site home page Giter Site logo

dribbble-php's Introduction

PHP Wrapper for Dribbble API

The Dribbble PHP API Wrapper is exactly what it says on the tin: it’s a simple wrapper for the Dribbble API for use in your PHP projects.

Installation

You can either download the latest version of the library, or the preferred way is to install it as a dependency with Composer, a dependency manager for PHP.

Installing with Composer

To install with Composer, simply add the following to your composer.json file:

{
    "require": {
        "martinbean/dribbble-php": "3.*"
    }
}

Then run composer.phar install from your command line.

Usage

You can use the wrapper in the traditional, include-and-instantiate-classes method; or (preferably) with Composer.

The API wrapper contains the following methods:

  • getShot()
  • getShotRebounds()
  • getShotComments()
  • getShotsList()
  • getPlayerShots()
  • getPlayerFollowingShots()
  • getPlayerLikes()
  • getPlayer()
  • getPlayerFollowers()
  • getPlayerFollowing()
  • getPlayerDraftees()

These correspond to the API methods as described on Dribbble’s API documentation page.

As per Dribbble’s documentation, some methods take an optional id parameter which can be either a player ID or alpha-numeric username; and some further methods take optional page and per_page parameters for pagination.

Responses

All responses from the Dribbble API PHP Wrapper are returned as PHP objects, so you can act on properties directly. If any errors are encountered, then a Dribbble\Api\Exception is thrown, which can be caught in a try/catch block.

An example usage would be:

<?php

require('vendor/autoload.php');

$client = new Dribbble\Api\Client();

try {
    $shots = $client->getPlayerShots('martinbean');
    foreach ($shots->shots as $shot) {
        printf('<li><a href="%s">%s</a></li>', $shot->url, $shot->title);
    }
}
catch (Dribbble\Exception $e) {
    printf('%d: %s', $e->getCode(), $e->getMessage());
}

This would fetch mine (martinbean) shots, but also catch any exceptions should they arise.

Other notes

The Dribbble API PHP Wrapper was created by Martin Bean and is released under the MIT License.

If you have any issues with the wrapper then please open an Issue on the GitHub project.

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.