PHP Bitbucket API

Simple Bitbucket API wrapper for PHP

Users ssh keys

Use the ssh-keys resource to manipulate the ssh-keys on an individual or team account.

Prepare:

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

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

Get a list of the keys associated with an account:

$users->sshKeys()->all($account_name);

Creates a key on the specified account:

$users->sshKeys()->create($account_name, 'key content', 'dummy key');

Updates a key on the specified account:

$users->sshKeys()->update($account_name, 12, 'key content');

Get the content of the specified key_id:

$users->sshKeys()->get($account_name, 12);

Delete a ssh key:

$users->sshKeys()->delete($account_name, 12);