simon-wessel/teamcity-api

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.

TeamCity API wrapper for PHP - usable with or without Laravel 5

1.0.0 2017-09-14 10:04 UTC

This package is not auto-updated.

Last update: 2021-11-17 06:38:13 UTC


README

Latest Stable Version Total Downloads Monthly Downloads License Latest Unstable Version

A simple PHP wrapper for the API of your TeamCity instance which may or may not be used as a Laravel package.

This package lacks most API functions provided by TeamCity due to the sheer amount of endpoints. If you need any of the missing functions, just add it to the API class and create a pull request.

Table of Contents

Installation

The package can be installed via composer by running

composer require simon-wessel/teamcity-api

Standalone usage

$url = "https://yoururltoteamcity.com/";
$username = "myusername";
$password = "mypassword";

$teamCityApi = new SimonWessel\TeamCityApi\TeamCityApi($url, $username, $password);

$builds = $teamCityApi->getBuilds();

Usage with Laravel

1. Setup

The package supports package auto-discovery which has been introduced in Laravel 5.5. If you are using 5.5 or above, you can skip this step.

Otherwise you have to add the Service Provider to the providers array in your config/app.php file:

SimonWessel\TeamcityApi\ServiceProvider::class,

And if you want to use the Facade, you have to add it to the aliases array in the same file:

'TeamCity' => \SimonWessel\TeamCityApi\Facade::class,

2. Configuration

You will need to configure a TeamCity user account with all permissions for the data and actions you want to access. You can either set the following environment variables in your .env file:

TEAMCITY_URL=https://yoururltoteamcity.com/
TEAMCITY_USERNAME=myusername
TEAMCITY_PASSWORD=mypassword

Or alternatively you can publish the package config file and adjust the settings in there. To do this run this command:

php artisan vendor:publish --provider="SimonWessel\TeamCityApi\ServiceProvider"

You will get a new config file config/teamcity.php with the available settings.

3. Usage

You can access the API with the Facade:

TeamCity::getBuilds()

Or calling the Service Provider singleton directly:

app('teamcity')->getBuilds()