Skip to content
haschek edited this page Sep 9, 2012 · 4 revisions

Github service class

The Github service can aggregate your recent activities on Github, it shows public repositories of users and organisations, and it includes public user gists.

Configuration values

You can configure all basic options of a service like title, description, total and cache_limit and special Github service options:

  • method: either GithubRecentActivity, GithubRepositories or GithubGists

for GithubRecentActivity

  • username: the username of the Github user, like in https://github.com/username

for GithubRepositories

  • owner: the username of the owner of the repositories, like in https://github.com/owner
  • ownertype: either users or orgs
  • sort: either full_name, created, pushed or updated (default is full_name)

for GithubGists

  • owner: the username of the owner of the gists, like in https://gist.github.com/owner

Example configuration

$github_activity = array(
    'Github', 'github_activity', array(
        'method' => 'GithubRecentActivity',
        'username' => 'haschek',
	'total' => 3,
	'title' => 'Github',
	'description' => 'recent activity'
    )
);

$github_repos = array(
    'Github', 'github_repos', array(
        'method' => 'GithubRepositories',
        'ownertype' => 'users',
        'owner' => 'haschek',
	'total' => 3,
	'title' => 'My Repos',
	'description' => 'recently updated repositories'
    )
);

$github_gists = array(
    'Github', 'github_gists', array(
        'method' => 'GithubGists',
        'owner' => 'haschek',
	'total' => 3,
	'title' => 'My Gists',
	'description' => 'recently updated gists'
    )
);

Template keys

for GithubRecentActivity

As this method is internally using the Feed service, you can use all Feed service keys.

for GithubRepositories and GithubGists

  • link: Github URI of the repository or gist
  • description: the description of the repository or gist
  • owner: the owner (as string) of the repository or gist
  • date: date of creation, last update, last push (depends on config)

for GithubRepositories

  • name: the name of the repository
  • homepage: the URI of the project homepage
  • language: the language that the project is written in, e.g. PHP
  • fork: boolean true, if the repository contains a fork
  • stars: number of people who starred the project (was: number of people watching the project)
  • forks: number of created forks
  • issues: number of active issues

Example template

function GithubRepositories_itemTemplate() {
    return '<li>
                <a href="{{{link}}}">{{{name}}}</a> {{#fork}}(forked){{/fork}}<br/>
                {{{description}}}
                ({{{date}}})
            </li>'.PHP_EOL;
}