PHP Bitbucket API

Simple Bitbucket API wrapper for PHP

Repositories

The repositories namespace has a number of resources you can use to manage repository. The following resources are available on repositories:

Prepare:

// @see: https://bitbucket.org/account/user/<username or team>/api
$oauth_params = array(
    'client_id'         => 'aaa',
    'client_secret'     => 'bbb'
);

$repositories = new \Bitbucket\API\Repositories();
$repositories->getClient()->addListener(
    new \Bitbucket\API\Http\Listener\OAuth2Listener($oauth_params)
);

Pagination:

$repo = new \Bitbucket\API\Repositories();
// auth here
$page = new \Bitbucket\API\Http\Response\Pager($repo->getClient(), $repo->all('gentlero'));

// get current page
$response = $page->getCurrent();

// next page
$response = $page->fetchNext();

Note: Any method of Pager that is prefixed with fetch implies that a new HTTP request will be made.

Get a list of repositories for an account:

If the caller is properly authenticated and authorized, this method returns a collection containing public and private repositories.

  $repositories->all($account_name);

Get a list of all public repositories:

Only public repositories are returned.

  $repositories->all();