You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using **laravel 5.0 or 5.1**(this version dependent on phpdotenv 1.x), then use **"1.5.\*"** version instead.
29
+
```json
30
+
{
31
+
"require": {
32
+
"lesstif/php-jira-rest-client": "^1.7.0"
33
+
}
34
+
}
35
+
```
36
+
**Note:**
37
+
If you are using **laravel 5.0 or 5.1**(this version dependent on phpdotenv 1.x), then use **"1.5.\*"** version instead.
38
38
39
39
3. Then run Composer's install or update commands to complete installation.
40
40
41
-
```sh
42
-
php composer.phar install
43
-
```
44
-
41
+
```sh
42
+
php composer.phar install
43
+
```
44
+
45
45
4. After installing, you need to require Composer's autoloader:
46
46
47
-
```php
48
-
require 'vendor/autoload.php';
49
-
```
47
+
```php
48
+
require 'vendor/autoload.php';
49
+
```
50
50
51
51
# Configuration
52
52
@@ -56,7 +56,7 @@ you can choose loads environment variables either 'dotenv' or 'array'.
56
56
57
57
58
58
copy .env.example file to .env on your project root.
59
-
59
+
60
60
JIRA_HOST="https://your-jira.host.com"
61
61
JIRA_USER="jira-username"
62
62
JIRA_PASS="jira-password"
@@ -247,9 +247,10 @@ try {
247
247
} catch (JiraException $e) {
248
248
print("Error Occured! " . $e->getMessage());
249
249
}
250
-
251
250
```
252
251
252
+
You can access the custom field associated with issue through *$issue->fields->customFields* array or through direct custom field id variables(Ex: *$issue->fields->customfield_10300*).
253
+
253
254
#### Create Issue
254
255
255
256
```php
@@ -281,9 +282,42 @@ try {
281
282
} catch (JiraException $e) {
282
283
print("Error Occured! " . $e->getMessage());
283
284
}
285
+
```
286
+
287
+
If you want to set custom field, you can call the *addCustomField* function with custom field id and value as parameters.
288
+
289
+
```php
290
+
try {
291
+
$issueField = new IssueField();
284
292
293
+
$issueField->setProjectKey("TEST")
294
+
->setSummary("something's wrong")
295
+
->setAssigneeName("lesstif")
296
+
->setPriorityName("Critical")
297
+
->setIssueType("Bug")
298
+
->setDescription("Full description for issue")
299
+
->addVersion("1.0.1")
300
+
->addVersion("1.0.3")
301
+
->addCustomField('customfield_10200', ['value' => 'Linux']) // Select List (single choice)
302
+
->addCustomField('customfield_10408', [
303
+
['value' => 'opt2'], ['value' => 'opt4']
304
+
]) // Select List (multiple choice)
305
+
306
+
;
307
+
308
+
$issueService = new IssueService();
309
+
310
+
$ret = $issueService->create($issueField);
311
+
312
+
//If success, Returns a link to the created issue.
313
+
print_r($ret);
314
+
} catch (JiraException $e) {
315
+
print("Error Occured! " . $e->getMessage());
316
+
}
285
317
```
286
318
319
+
Currently, not tested for all custom field types.
320
+
287
321
#### Create Multiple Issue
288
322
289
323
```php
@@ -333,7 +367,7 @@ Creating a sub-task is similar to creating a regular issue, with two important m
333
367
```
334
368
335
369
for example
336
-
370
+
337
371
```php
338
372
<?php
339
373
require 'vendor/autoload.php';
@@ -429,6 +463,8 @@ try {
429
463
430
464
```
431
465
466
+
If you want to change the custom field type when updating an issue, you can call the *addCustomField* function just as you did for creating issue.
0 commit comments