PHP code example of 42sol / laravel-youtrack-client

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

    

42sol / laravel-youtrack-client example snippets


'providers' => [
    // other service providers
    YouTrackClient\Providers\YouTrackClientProvider::class,
]

/**
 * This will make routes:
 *  - /yt/projects
 *  - /yt/issues
 *  - ...
 */
Route::prefix('/yt')->group(function () {
    YouTrackClient\YouTrackRoutes::apply();
});

use YouTrackClient\YouTrackClient;

$client = new YouTrackClient([
    'baseUrl' => 'https://youtrack.example.com/api',
    'hubUrl' => 'https://youtrack.example.com/hub/api/rest', // optional
    'token' => '<youtrack access token>'
]);

$client->getProjects();

use YouTrackClient\YouTrackClient;

class YoutrackTestController extends Controller
{
    private YouTrackClient $client;

    // YouTrackClient will be injected here
    public function __construct(YouTrackClient $client)
    {
        $this->client = $client;
    }

    public function getProjects() {
        return $this->client->getProjects();
    }
}
shell
php artisan vendor:publish --provider="YouTrackClient\Providers\YouTrackClientProvider"