PHP code example of steffenbrand / bamboo-api-client

1. Go to this page and download the library: Download steffenbrand/bamboo-api-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/ */

    

steffenbrand / bamboo-api-client example snippets


try {
    $client = new BambooClient(
        'http://bamboo.dev',
        'user',
        'pass'
    );
    
    $result = $client->getLatestResultByKey('MYPLAN-KEY');
    
    $result->getNumber();
    $result->getState();
    $result->getLink()->getHref();
    $result->getPlan()->getKey();
    $result->getPlan()->getName();
    $result->getPlan()->getShortKey();
    $result->getPlan()->getShortName();
    $result->getPlan()->getLink()->getHref();
} catch (BambooRequestException $e) {
    // Request might fail
} catch (\RuntimeException $e) {
    // Something could go wrong during runtime
}

try {
    $client = new BambooClient(
        'http://bamboo.dev',
        'user',
        'pass'
    );
    
    $result = $client->getPlanList();
    
    if (count($result) > 0) {
        foreach ($result as $plan) {
            $plan->getKey();
            $plan->getName();
            $plan->getShortKey();
            $plan->getShortName();
            $plan->getLink()->getHref();
        }
    }
} catch (BambooRequestException $e) {
    // Request might fail
} catch (\RuntimeException $e) {
    // Something could go wrong during runtime
}