2

Anyone have tried using https://github.com/nepda/youtrack? I'm trying to setup it but getting error :

Fatal error: Class 'YouTrack\Exception' not found in D:\wamp\www\flow\libs\YouTrack\Connection.php on line 117

the library can be found at https://github.com/nepda/youtrack so what I did is downloaded it and do test :

include_once './config/config_inc.php';
include_once './libs/parser.php';

require_once("./libs/YouTrack/Connection.php");
try {
    $youtrack = new YouTrack\Connection(
        YOUTRACK_URL,
        YOUTRACK_USERNAME . 'invalid',
        YOUTRACK_PASSWORD
    );
    echo 'Login correct.' . PHP_EOL;
} catch (\YouTrack\IncorrectLoginException $e) {

    echo 'Incorrect login or password.' . PHP_EOL;
}
Monnster
  • 625
  • 7
  • 16

1 Answers1

0

You need some sort of autoloading. In this case a very simple setup would be:

<?php
function __autoload($class)
{
    $path = str_replace('\\', '/', $class);
    require_once $path . '.php';
}

try {
    $youtrack = new YouTrack\Connection(
        YOUTRACK_URL,
        YOUTRACK_USERNAME . 'invalid',
        YOUTRACK_PASSWORD
    );
    echo 'Login correct.' . PHP_EOL;
} catch (\YouTrack\IncorrectLoginException $e) {

    echo 'Incorrect login or password.' . PHP_EOL;
}

(This will work with version 1.5.3 of nepda/youtrack-client).

I've added a readme section "Standalone setup with composer".

Please checkout composer for managing your packages. Composer comes with a good implementation of autoloading.

Nepomuk Pajonk
  • 2,972
  • 1
  • 19
  • 29