PHP code example of cybercog / laravel-youtrack-sdk

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

    

cybercog / laravel-youtrack-sdk example snippets


$youtrack = app(\Cog\Contracts\YouTrack\Rest\Client\Client::class);

$method = 'POST'; // GET, POST, PUT, DELETE, PATCH or any custom ones
$response = $youtrack->request($method, '/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
]);

$options = [
    'debug' => true,
    'sink' => '/path/to/dump/file',
];
$response = $youtrack->request('POST', '/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
], $options);

$response = $youtrack->get('/issue/TEST-1');

$response = $youtrack->post('/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
]);

$response = $youtrack->put('/issue/TEST-1', [
    'summary' => 'Updated summary',
    'description' => 'Updated description',
]);

$response = $youtrack->delete('/issue/TEST-1');

$youtrackResponse = $youtrack->get('/issue/TEST-1');
$psrResponse = $youtrackResponse->httpResponse();

$apiResponse = $youtrack->get('/issue/TEST-1');
$cookieString = $apiResponse->cookie();

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->location();

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->toArray();

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->statusCode();
shell
php artisan vendor:publish --tag="youtrack-config"