mikaelbr/phpcoderwall

PHP library for fetching Coderwall data

dev-master 2012-08-29 10:24 UTC

This package is not auto-updated.

Last update: 2025-07-05 17:43:04 UTC


README

Requirements

  • PHP > v.5.3.0
  • Access to request pages (curl or file_get_contents)

For easier installation you should also have composer installed.

Documentation and Examples

Fetching user information

<?php
require 'vendor/autoload.php';

$coderwall = PhpCoderwall\PhpCoderwall::getInstance();
$user = $coderwall->getUser("mikaelbr", true);

// E.g. use:
echo $user->name;
?>

Notice: The second argument defines if we want to fetch full information about a user. This entails more user properties and full information about the team given user is a part of.

Properties of the CoderwallUser object

PropertyDescription
username The username of given user.
name Full name of the user.
location Location of the user. E.g. Norway.
endorsements The number of endorsements a user has recived.
team This is a ID to the users team. Can be run through PhpCoderwall#getTeamById() to get full team information.
accounts Collection of all the account types the user has on Coderwall. See more information under properties of the Account object.
badges A collection of CoderwallBadges. See more information about the badges class below.
badgesCount The number of total badges the user has.

Additional properties of the full information CoderwallUser object

PropertyDescription
title Self set title for user.
company What company the user works for
thumbnail URL to the avatar image thumbnail.
specialities Collection of strings. A set of specialities the user has added.
accomplishments Collection of strings. A set of accomplishments the user has added

Properties of the Account object

PropertyDescription
type The account type. Either github, twitter or linkedin
username The users username on the given account type.

Properties of the CoderwallBadge object

PropertyDescription
name The name of the achivement/badge.
description Extended badge description
created A timestamp of when the user recived the badge. E.g. "2012-02-23T19:03:55Z"
badge URL to the badge image.

Fetching team information

<?php
require 'vendor/autoload.php';

$coderwall = PhpCoderwall\PhpCoderwall::getInstance();
$team = $coderwall->getTeam("Github");

// E.g. use:
echo $team->score;
?>

Notice: As per now, the Coderwall's Team API isn't really open and working, so there is a 5 min cache. This means that if you try to first get the Github team and right away the Heroku team, you'll get the Github team information both times. We'll just have to wait until Coderwall releases the Team API to the public.

Properties of the CoderwallTeam object

PropertyDescription
name The name of the team.
id The teams unique ID.
score Score in the Coderwall leader board.
rank Ranking in the Coderwall leader board.
size Number of team members
slug Filtered team name, used in the Coderwall URL.
avatar URL to the image avatar.
country Collection of strings. With each index a country of the given team.
neighbors Overview of the team neighbors. Collection of simplified CoderwallTeam objects with all properties set, except the following: neighbors and teamMembers
teamMembers Overview of the teams members. Collection of simplified CoderwallUser objects only with the following properties set: username, name, endorsements and badgesCount

Fetching team information by team ID

<?php
require 'vendor/autoload.php';

$coderwall = PhpCoderwall\PhpCoderwall::getInstance();
$team = $coderwall->getTeamById("4f27193d973bf0000400029d");

// E.g. use:
echo $team->name; // Github
?>

Returns a CoderwallTeam object as seen above.

Installation

Install phpCoderwall by using composer and add a composer.json file to your root, with the following content:

{
    "require": {
        "mikaelbr/phpcoderwall": "dev-master"
    }
}

Then run (in the root, with a terminal), depending on your setup, either

composer install

or

php composer.phar install

With this you can try to run a example as shown above.

You can also use this library without composer. Just get the code base by cloning the repository, and either write an auto load function or require the files manually.