PHP code example of atlassian / stash-client

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

    

atlassian / stash-client example snippets



use Atlassian\Stash\StashClient;

// Init client, user/pass is optional
$stash = new StashClient('http://git.example.com', 'user', 'password');

// returns array of Atlassian\Stash\Api\Project
$projects = $stash->getProjects();

// returns array of Atlassian\Stash\Api\Repo
$repos = $stash->getRepos('test'); // By Project Key

// returns contents of file as a string
$fileContents = $stash->getRepoFileContents($repos[0], '/someFile.txt');