PHP code example of bitbucket / client

1. Go to this page and download the library: Download bitbucket/client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bitbucket / client example snippets


$client = new Bitbucket\Client();

$client->authenticate(
    Bitbucket\Client::AUTH_OAUTH_TOKEN,
    'your-token-here'
);

$client = new Bitbucket\Client();

$client->authenticate(
    Bitbucket\Client::AUTH_HTTP_PASSWORD,
    'your-username-here',
    'your-password-here'
);

$client = new Bitbucket\Client();

$client->authenticate(
    Bitbucket\Client::AUTH_JWT,
    'your-jwt-here'
);

$currentUser = $client->currentUser()->show();

$repository = $client->repositories()
    ->workspaces('atlassian')
    ->show('stash-example-plugin');

$paginator = new Bitbucket\ResultPager($client);

$branchesClient = $client->repositories()
    ->workspaces('atlassianlabs')
    ->refs('stash-log-parser'])
    ->branches();

$branches = $paginator->fetchAll($branchesClient, 'list');