opensoft/tfs-rest-api

用于 TFS/VisualStudio REST API 的 API 包装器

dev-master 2015-11-12 00:03 UTC

This package is auto-updated.

Last update: 2024-08-27 06:11:47 UTC


README

这是一个简单的面向对象的 PHP 5.5 包装器,用于 Visual Studio Online / Team Foundation Server REST API

使用 Guzzle 6 进行 REST 请求。

安装

可以通过 composer 进行安装

$ composer require opensoft/tfs-rest-api

基本用法

<?php

use Opensoft\Tfs\Rest\Client;

require_once __DIR__ . '/vendor/autoload.php';

$client = new Client(
    // your tfs/vso
    'https://opensoft.visualstudio.com',
    // your collection
    'AcmeApp',
    // (optional) raw options to pass to guzzle (ntlm example here)
    [                                      
        'curl' => [
            CURLOPT_HTTPAUTH => CURLAUTH_NTLM, 
            CURLOPT_USERPWD => 'username:password'
        ]
    ]
);

// retrieve a work item by its ID
$response = $client->workItemTracking()->getWorkItem(12345);

// get the result as an array
print_r($response->asArray());

// follow hypermedia links
$response = $response->follow('workItemHistory');

print_r($response->asArray());

注意: TFS/VSO 提供了比此处实现更多的 API。我们目前只实现了内部需要的 API,并将根据需要继续实现更多。请随时提交实现更多 API 的 pull 请求,我们将很乐意将其合并。

许可证

在 MIT 许可证下发布 - 有关详细信息,请参阅 LICENSE 文件