PHP code example of nepda / youtrack-client

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

    

nepda / youtrack-client example snippets



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


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


// ... snip
if ($zf2Path) {
    if (isset($loader)) {
        $loader->add('Zend', $zf2Path);
    } else {
             'autoregister_zf' => true,
                'namespaces' => [                            // add this
                    'YouTrack' => 'vendor/YouTrack'          // ...
                ],                                           // ...
            )
        ));
    }
}
// ... snip


// ...
// 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");
        // ...
    }
}


define('YOUTRACK_URL', 'https://*your-url*.myjetbrains.com/youtrack');
define('YOUTRACK_USERNAME', '***');
define('YOUTRACK_PASSWORD', '***');
o '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;
}
sh
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