PHP Bitbucket API

Simple Bitbucket API wrapper for PHP

Deploykeys

Manage ssh keys used for deploying product builds.

Prepare:

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

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

Get a list of keys:

$dk->all($account_name, $repo_slug);

Get a key content:

$dk->get($account_name, $repo_slug, 508372);

Add a new key:

$dk->create($account_name, $repo_slug, 'ssh-rsa [...]', 'test key');

Update an existing key:

$dk->update($account_name, $repo_slug, '508380', array('label' => 'test [edited]'));

Delete an existing key:

$dk->delete($account_name, $repo_slug, '508380');