2017 © Pedro Peláez
 

library youtrack-client

A PHP YouTrack client library

image

nepda/youtrack-client

A PHP YouTrack client library

  • Monday, May 14, 2018
  • by nepda
  • Repository
  • 6 Watchers
  • 22 Stars
  • 74,082 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 36 Forks
  • 0 Open issues
  • 51 Versions
  • 48 % Grown

The README.md

YouTrack Client PHP Library

Attention! This library is based on the now-deprecated REST API for YouTrack. jetBrains has release a new version of their REST API. May be I'll create a new version of this library for the new API., (*1)

Build Status Packagist, (*2)

The bugtracker YouTrack provides a REST-API. Because a lot of web applications are written in PHP I decided to write a client library for it. To make it easier for developers to write connectors to YouTrack., (*3)

The initial development was sponsored by Telematika GmbH. The current development is made by nepda., (*4)

The source of this library is released under the BSD license (see LICENSE for details)., (*5)

Requirements

  • PHP >= 5.4 (Tested with >= 5.6, Travis runs tests with ~~5.4, 5.5~~, 5.6, 7.0, 7.1, 7.2, 7.3 and 7.4)
  • curl
  • simplexml
  • json
  • YouTrack 3.0+ with REST-API enabled (currently, the production system runs with YouTrack 2019.1)

Changelog

Please look into CHANGELOG for a list of the past releases., (*6)

Usage

With permanent token

Please look into the YouTrack documentation on how to create such a permanent token., (*7)

<?php
require_once("YouTrack/Connection.php");
$youtrack = new \YouTrack\Connection("http://example.com", "perm:*****", null);
$issue = $youtrack->getIssue("TEST-1");
// ...

The $password parameter has to be null for permanent token login. This feature is dirty and will be fixed in version 2.*., (*8)

With deprecated username/password login

<?php
require_once("YouTrack/Connection.php");
$youtrack = new \YouTrack\Connection("http://example.com", "login", "password");
$issue = $youtrack->getIssue("TEST-1");
// ...

See ./examples folder for more usage examples., (*9)

Usage with ZF2 ZendSkeletonApplication

In your /init_autoloader.php, (*10)

<?php
// ... snip
if ($zf2Path) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
    } else {
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true,
                'namespaces' => [                            // add this
                    'YouTrack' => 'vendor/YouTrack'          // ...
                ],                                           // ...
            )
        ));
    }
}
// ... snip

From now on you can use YouTrack-Client-PHP-Library from any file in you ZF2-App., (*11)

<?php
// ...
// example
use YouTrack\Connection as YouTrackConnection;

class ExampleController extends AbstractActionController
{

    public function anyAction()
    {
        $youtrack = new YouTrackConnection("http://example.com", "login", "password");
        $issue = $youtrack->getIssue("TEST-1");
        // ...
    }
}

Standalone setup with composer

Run the following commands to install composer and youtrack-client., (*12)

mkdir my-youtrack-project
cd my-youtrack-project

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

php composer.phar require nepda/youtrack-client

(Please checkout the latest composer setup on their page), (*13)

Create a ./my-youtrack-project/client.php file with content:, (*14)

<?php
define('YOUTRACK_URL', 'https://*your-url*.myjetbrains.com/youtrack');
define('YOUTRACK_USERNAME', '***');
define('YOUTRACK_PASSWORD', '***');
require_once 'vendor/autoload.php';
try {
    $youtrack = new YouTrack\Connection(
        YOUTRACK_URL,
        YOUTRACK_USERNAME . 'invalid',
        YOUTRACK_PASSWORD
    );
    echo 'Login correct.' . PHP_EOL;

    $issue = $youtrack->getIssue('TEST-123');
    // Now you can work with the issue or other $youtrack methods
} catch (\YouTrack\IncorrectLoginException $e) {
    echo 'Incorrect login or password.' . PHP_EOL;
}
$issue = $youtrack->getIssue('TEST-123');
// Now you can work with the issue or other $youtrack methods

} catch (\YouTrack\IncorrectLoginException $e) { echo 'Incorrect login or password.' . PHP_EOL; }, (*15)


With this simple setup you're ready to go. ## Tests The testsuite depends on PHPUnit. You can install it with `composer.phar`: ```sh curl -sS https://getcomposer.org/installer | php -- php composer.phar install

The unit tests are incomplete but you can run them using phpunit like this:, (*16)

./vendor/bin/phpunit ./test

Contributors

(and more: https://github.com/nepda/youtrack-client/network/members), (*17)

The Versions

14/05 2018

dev-master

9999999-dev

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

14/05 2018

v1.7.9

1.7.9.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

13/04 2018

v1.7.8

1.7.8.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

02/04 2018

1.0-rc2

1.0.0.0-RC2

  Sources   Download

02/04 2018

1.0

1.0.0.0

  Sources   Download

02/04 2018

1.0-rc1

1.0.0.0-RC1

  Sources   Download

02/04 2018

1.0-rc3

1.0.0.0-RC3

  Sources   Download

02/04 2018

1.0-rc4

1.0.0.0-RC4

  Sources   Download

02/04 2018

1.0-rc5

1.0.0.0-RC5

  Sources   Download

02/04 2018

1.0-rc6

1.0.0.0-RC6

  Sources   Download

02/04 2018

1.0-rc7

1.0.0.0-RC7

  Sources   Download

28/02 2018

v1.7.7

1.7.7.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

23/02 2018

v1.7.6

1.7.6.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

23/01 2018

v1.7.5

1.7.5.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

19/01 2018

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

17/01 2018

v1.7.4

1.7.4.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

17/01 2018

v1.7.3

1.7.3.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

23/08 2017

v1.7.2

1.7.2.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

22/08 2017

v1.7.1

1.7.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

29/05 2017

v1.7.0

1.7.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

18/05 2017

v1.6.3

1.6.3.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

27/04 2017

v1.6.2

1.6.2.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

28/03 2017

v1.6.1

1.6.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

15/03 2017

v1.6.0

1.6.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

03/02 2017

v1.5.4

1.5.4.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

19/01 2017

v1.5.3

1.5.3.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

19/01 2017

v1.5.2

1.5.2.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

08/12 2016

dev-php-7.1-test

dev-php-7.1-test

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

03/10 2016

v1.5.1

1.5.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

01/10 2016

v1.5.0

1.5.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

11/08 2016

v1.4.2

1.4.2.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

04/08 2016

v1.4.1

1.4.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

26/04 2016

v1.4.0

1.4.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

25/04 2016

v1.3.0

1.3.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

15/02 2016

v1.2.4

1.2.4.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

14/02 2016

v1.2.3

1.2.3.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

11/02 2016

v1.2.2

1.2.2.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

08/02 2016

dev-low-php-test

dev-low-php-test

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

08/02 2016

v1.2.1

1.2.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.6

 

The Development Requires

by Sergey Susikov

08/02 2016

v1.2.0

1.2.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.6

 

The Development Requires

by Sergey Susikov

08/02 2016

v1.0.10

1.0.10.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

by Sergey Susikov

06/12 2015

v1.1.1

1.1.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.6

 

The Development Requires

06/12 2015

v1.1.0

1.1.0.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.6

 

The Development Requires

06/12 2015

dev-php7-test

dev-php7-test

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

10/02 2015

v1.0.9

1.0.9.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

15/01 2015

v1.0.8

1.0.8.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

02/12 2014

1.0.7

1.0.7.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • ext-json >=1
  • lib-curl >=7
  • php >=5.4

 

The Development Requires

29/11 2014

1.0.6

1.0.6.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • lib-curl >=7
  • php >=5.4

 

The Development Requires

29/11 2014

1.0.5

1.0.5.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • lib-curl >=7
  • php >=5.4

 

The Development Requires

05/11 2014

1.0.4

1.0.4.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • lib-curl >=7
  • php >=5.4

 

The Development Requires

01/09 2014

1.0.1

1.0.1.0

A PHP YouTrack client library

  Sources   Download

BSD-4-Clause

The Requires

  • lib-curl >=7
  • php >=5.4

 

The Development Requires