devmoath / jira-php
Jira PHP is a supercharged PHP API client that allows you to interact with the Jira API and the Service Desk API
Installs: 8 456
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 1
Forks: 4
Open Issues: 2
Requires
- php: ^8.1.0
- guzzlehttp/guzzle: ^7.5.0
Requires (Dev)
- laravel/pint: ^1.2.0
- nunomaduro/collision: ^7.0.0
- pestphp/pest: ^2.0.0
- pestphp/pest-plugin-mock: ^2.0.0
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.8.6
- phpstan/phpstan-strict-rules: ^1.4
- rector/rector: ^0.14.4
- symfony/var-dumper: ^6.2.0
README
Jira PHP is a supercharged PHP API client that allows you to interact with the Jira API and the Service Desk API.
Get Started
Requires PHP 8.1+
First, install devmoath/jira-php
via the Composer package manager:
composer require devmoath/jira-php
Then, interact with Jira's APIs:
$client = Jira::client('USERNAME', 'PASSWORD', 'jira.domain.com'); $result = $client->issues()->search(); echo $result['issues'][0]['key']; // KEY-1000
Usage
Attachments
Resource
get
function
Retrieve the meta-data for an attachment.
$client->attachments()->get(id: '1000');
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000', 'filename' => 'picture.jpg', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.478+0000', 'size' => 23123, 'mimeType' => 'image/jpeg', 'content' => 'https://www.example.com/jira/attachments/10000', 'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000', ];
remove
function
Remove an attachment.
$client->attachments()->remove(id: '1000');
response example
null
download
function
Download an attachment content.
$attachment = $client->attachments()->get(id: '1000'); $client->attachments()->download(url: $attachment['content']);
response example
{"a":"b"}\n
Customers
Resource
create
function
Create a customer that is not associated with a service project.
$client->customers()->create( body: [ 'fullName' => 'name', 'email' => 'name@example.com', ], );
response example
[ 'name' => 'fred', 'key' => 'fred', 'emailAddress' => 'fred@example.com', 'displayName' => 'Fred F. User', 'active' => true, 'timeZone' => 'Australia/Sydney', '_links' => [ 'jiraRest' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', ], ];
Groups
Resource
create
function
Create a group by given group parameter.
$client->groups()->create( body: [ 'name' => 'group name', ], );
response example
[ 'name' => 'jira-administrators', 'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-administrators', 'users' => [ 'size' => 1, 'items' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], ], 'max-results' => 50, 'start-index' => 0, 'end-index' => 0, ], 'expand' => 'users', ];
remove
function
Delete a group by given group parameter.
$client->groups()->remove( query: [ 'name' => 'group name', ], );
response example
null
getUsers
function
Return a paginated list of users who are members of the specified group and its subgroups.
$client->groups()->getUsers( query: [ 'groupname' => 'group name', ], );
response example
[ 'self' => 'https://example.com/rest/api/2/group/member?groupname=admin&startAt=2&maxResults=2', 'nextPage' => 'https://example.com/rest/api/2/group/member?groupname=admin&startAt=4&maxResults=2', 'maxResults' => 2, 'startAt' => 3, 'total' => 5, 'isLast' => false, 'values' => [ [ 'self' => 'https://example/jira/rest/api/2/user?username=fred', 'name' => 'Fred', 'key' => 'fred', 'emailAddress' => 'fred@atlassian.com', 'avatarUrls' => [], 'displayName' => 'Fred', 'active' => true, 'timeZone' => 'Australia/Sydney', ], [ 'self' => 'https://example/jira/rest/api/2/user?username=barney', 'name' => 'Barney', 'key' => 'barney', 'emailAddress' => 'barney@atlassian.com', 'avatarUrls' => [], 'displayName' => 'Barney', 'active' => false, 'timeZone' => 'Australia/Sydney', ], ], ];
addUser
function
Add given user to a group.
$client->groups()->addUser( query: [ 'groupname' => 'group name', ], body: [ 'name' => 'user name', ], );
response example
[ 'name' => 'example', 'self' => 'url', 'users' => [], 'expand' => '', ];
removeUser
function
Remove given user from a group.
$client->groups()->removeUser( query: [ 'groupname' => 'group name', 'username' => 'user name', ], );
response example
null
Issues
Resource
create
function
Create an issue or a sub-task from a JSON representation.
$client ->issues() ->create(body: [...]);
response example
[ 'id' => '10000', 'key' => 'TST-24', 'self' => 'https://www.example.com/jira/rest/api/2/issue/10000', ];
bulk
function
Create issues or sub-tasks from a JSON representation.
$client ->issues() ->bulk(body: [ [...], [...], [...] ]);
response example
[ 'issues' => [ [ 'id' => '10000', 'key' => 'TST-24', 'self' => 'https://www.example.com/jira/rest/api/2/issue/10000', ], [ 'id' => '10001', 'key' => 'TST-25', 'self' => 'https://www.example.com/jira/rest/api/2/issue/10001', ], ], 'errors' => [], ];
get
function
Return a full representation of the issue for the given issue key.
$client->issues()->get(id: 'KEY-1000', query: [...]);
response example
[ 'expand' => 'renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations', 'id' => '10002', 'self' => 'https://www.example.com/jira/rest/api/2/issue/10002', 'key' => 'EX-1', 'fields' => [ 'watcher' => [ 'self' => 'https://www.example.com/jira/rest/api/2/issue/EX-1/watchers', 'isWatching' => false, 'watchCount' => 1, 'watchers' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], ], ], 'attachment' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000', 'filename' => 'picture.jpg', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.478+0000', 'size' => 23123, 'mimeType' => 'image/jpeg', 'content' => 'https://www.example.com/jira/attachments/10000', 'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000', ], ], 'sub-tasks' => [ [ 'id' => '10000', 'type' => [ 'id' => '10000', 'name' => '', 'inward' => 'Parent', 'outward' => 'Sub-task', ], 'outwardIssue' => [ 'id' => '10003', 'key' => 'EX-2', 'self' => 'https://www.example.com/jira/rest/api/2/issue/EX-2', 'fields' => [ 'status' => [ 'iconUrl' => 'https://www.example.com/jira/images/icons/statuses/open.png', 'name' => 'Open', ], ], ], ], ], 'description' => 'example bug report', 'project' => [ 'self' => 'https://www.example.com/jira/rest/api/2/project/EX', 'id' => '10000', 'key' => 'EX', 'name' => 'Example', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/projectavatar?size=large&pid=10000', '24x24' => 'https://www.example.com/jira/secure/projectavatar?size=small&pid=10000', '16x16' => 'https://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000', '32x32' => 'https://www.example.com/jira/secure/projectavatar?size=medium&pid=10000', ], 'projectCategory' => [ 'self' => 'https://www.example.com/jira/rest/api/2/projectCategory/10000', 'id' => '10000', 'name' => 'FIRST', 'description' => 'First Project Category', ], ], 'comment' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000', 'id' => '10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'body' => 'Lorem ipsum dolor sit amet.', 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.180+0000', 'updated' => '2019-02-09T10:08:20.181+0000', 'visibility' => [ 'type' => 'role', 'value' => 'Administrators', ], ], ], 'issuelinks' => [ [ 'id' => '10001', 'type' => [ 'id' => '10000', 'name' => 'Dependent', 'inward' => 'depends on', 'outward' => 'is depended by', ], 'outwardIssue' => [ 'id' => '10004L', 'key' => 'PRJ-2', 'self' => 'https://www.example.com/jira/rest/api/2/issue/PRJ-2', 'fields' => [ 'status' => [ 'iconUrl' => 'https://www.example.com/jira//images/icons/statuses/open.png', 'name' => 'Open', ], ], ], ], [ 'id' => '10002', 'type' => [ 'id' => '10000', 'name' => 'Dependent', 'inward' => 'depends on', 'outward' => 'is depended by', ], 'inwardIssue' => [ 'id' => '10004', 'key' => 'PRJ-3', 'self' => 'https://www.example.com/jira/rest/api/2/issue/PRJ-3', 'fields' => [ 'status' => [ 'iconUrl' => 'https://www.example.com/jira//images/icons/statuses/open.png', 'name' => 'Open', ], ], ], ], ], 'worklog' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/worklog/10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'comment' => 'I did some work here.', 'updated' => '2019-02-09T10:08:20.486+0000', 'visibility' => [ 'type' => 'group', 'value' => 'jira-developers', ], 'started' => '2019-02-09T10:08:20.486+0000', 'timeSpent' => '3h 20m', 'timeSpentSeconds' => 12000, 'id' => '100028', 'issueId' => '10002', ], ], 'updated' => 1, 'timetracking' => [ 'originalEstimate' => '10m', 'remainingEstimate' => '3m', 'timeSpent' => '6m', 'originalEstimateSeconds' => 600, 'remainingEstimateSeconds' => 200, 'timeSpentSeconds' => 400, ], ], 'names' => [ 'watcher' => 'watcher', 'attachment' => 'attachment', 'sub-tasks' => 'sub-tasks', 'description' => 'description', 'project' => 'project', 'comment' => 'comment', 'issuelinks' => 'issuelinks', 'worklog' => 'worklog', 'updated' => 'updated', 'timetracking' => 'timetracking', ], 'schema' => [], ];
delete
function
Delete an issue.
$client->issues()->delete(id: 'KEY-1000', query: [...]);
response example
null
edit
function
Edit an issue from a JSON representation.
$client->issues()->edit(id: 'KEY-1000', body: [...], query: [...]);
response example
null
archive
function
Archive an issue.
$client->issues()->archive(id: 'KEY-1000');
response example
null
assign
function
Assign an issue to a user.
$client->issues()->assign(id: 'KEY-1000', body: [...]);
response example
null
getComments
function
Return all comments for an issue.
$client->issues()->getComments(id: 'KEY-1000', query: [...]);
response example
[ 'startAt' => 0, 'maxResults' => 1, 'total' => 1, 'comments' => [ [ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000', 'id' => '10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'body' => 'Lorem ipsum dolor sit amet.', 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.180+0000', 'updated' => '2019-02-09T10:08:20.181+0000', 'visibility' => [ 'type' => 'role', 'value' => 'Administrators', ], ], ], ];
addComment
function
Add new comment to an issue.
$client->issues()->addComment(id: 'KEY-1000', body: [...], query: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000', 'id' => '10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'body' => 'Lorem ipsum dolor sit amet.', 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.180+0000', 'updated' => '2019-02-09T10:08:20.181+0000', 'visibility' => [ 'type' => 'role', 'value' => 'Administrators', ], ];
updateComment
function
Update existing comment using its JSON representation.
$client->issues()->updateComment(id: 'KEY-1000', commentId: '10000', body: [...], query: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000', 'id' => '10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'body' => 'Lorem ipsum dolor sit amet.', 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.180+0000', 'updated' => '2019-02-09T10:08:20.181+0000', 'visibility' => [ 'type' => 'role', 'value' => 'Administrators', ], ];
deleteComment
function
Delete an existing comment.
$client->issues()->deleteComment(id: 'KEY-1000', commentId: '10000', query: [...]);
response example
null
getComment
function
Return a single comment.
$client->issues()->getComment(id: 'KEY-1000', commentId: '10000', query: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/issue/10010/comment/10000', 'id' => '10000', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'body' => 'Lorem ipsum dolor sit amet.', 'updateAuthor' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.180+0000', 'updated' => '2019-02-09T10:08:20.181+0000', 'visibility' => [ 'type' => 'role', 'value' => 'Administrators', ], ];
getTransitions
function
Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
$client->issues()->getTransitions(id: 'KEY-1000', query: [...]);
response example
[ 'expand' => 'transitions', 'transitions' => [ [ 'id' => '2', 'name' => 'Close Issue', 'to' => [ 'self' => 'https://localhost:8090/jira/rest/api/2.0/status/10000', 'description' => 'The issue is currently being worked on.', 'iconUrl' => 'https://localhost:8090/jira/images/icons/progress.gif', 'name' => 'In Progress', 'id' => '10000', 'statusCategory' => [ 'self' => 'https://localhost:8090/jira/rest/api/2.0/statuscategory/1', 'id' => 1, 'key' => 'in-flight', 'colorName' => 'yellow', 'name' => 'In Progress', ], ], 'fields' => [ 'summary' => [ 'required' => false, 'schema' => [ 'type' => 'array', 'items' => 'option', 'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect', 'customId' => 10001, ], 'name' => 'My Multi Select', 'hasDefaultValue' => false, 'operations' => ['set', 'add'], 'allowedValues' => ['red', 'blue'], ], ], ], [ 'id' => '711', 'name' => 'QA Review', 'to' => [ 'self' => 'https://localhost:8090/jira/rest/api/2.0/status/5', 'description' => 'The issue is closed.', 'iconUrl' => 'https://localhost:8090/jira/images/icons/closed.gif', 'name' => 'Closed', 'id' => '5', 'statusCategory' => [ 'self' => 'https://localhost:8090/jira/rest/api/2.0/statuscategory/9', 'id' => 9, 'key' => 'completed', 'colorName' => 'green', ], ], 'fields' => [ 'summary' => [ 'required' => false, 'schema' => [ 'type' => 'array', 'items' => 'option', 'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect', 'customId' => 10001, ], 'name' => 'My Multi Select', 'hasDefaultValue' => false, 'operations' => ['set', 'add'], 'allowedValues' => ['red', 'blue'], ], 'colour' => [ 'required' => false, 'schema' => [ 'type' => 'array', 'items' => 'option', 'custom' => 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect', 'customId' => 10001, ], 'name' => 'My Multi Select', 'hasDefaultValue' => false, 'operations' => ['set', 'add'], 'allowedValues' => ['red', 'blue'], ], ], ], ], ];
doTransition
function
Perform a transition on an issue.
$client->issues()->doTransition(id: 'KEY-1000', body: [...], query: [...]);
response example
null
attach
function
Add one or more attachments to an issue.
$client->issues()->attach(id: 'KEY-1000', body: [...]);
response example
[ [ 'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10000', 'filename' => 'picture.jpg', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.478+0000', 'size' => 23123, 'mimeType' => 'image/jpeg', 'content' => 'https://www.example.com/jira/attachments/10000', 'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10000', ], [ 'self' => 'https://www.example.com/jira/rest/api/2.0/attachments/10001', 'filename' => 'dbeuglog.txt', 'author' => [ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'displayName' => 'Fred F. User', 'active' => false, ], 'created' => '2019-02-09T10:08:20.478+0000', 'size' => 2460, 'mimeType' => 'text/plain', 'content' => 'https://www.example.com/jira/attachments/10001', 'thumbnail' => 'https://www.example.com/jira/secure/thumbnail/10002', ], ];
search
function
Search for issues using JQL.
$client->issues()->search(query: [...]);
response example
[ 'expand' => 'names,schema', 'startAt' => 0, 'maxResults' => 50, 'total' => 1, 'issues' => [ [ 'expand' => '', 'id' => '10001', 'self' => 'https://www.example.com/jira/rest/api/2/issue/10001', 'key' => 'HSP-1', ], ], ];
Requests
Resource
create
function
Create a customer request in a service project.
$client->requests()->create(body: [...]);
response example
[ '_expands' => ['participant', 'status', 'sla', 'requestType', 'serviceDesk'], 'issueId' => '107001', 'issueKey' => 'HELPDESK-1', 'requestTypeId' => '25', 'serviceDeskId' => '10', 'createdDate' => [ 'iso8601' => '2015-10-08T14:42:00+0700', 'jira' => '2015-10-08T14:42:00.000+0700', 'friendly' => 'Monday 14:42 PM', 'epochMillis' => 1444290120000, ], 'reporter' => [ 'name' => 'fred', 'key' => 'fred', 'emailAddress' => 'fred@example.com', 'displayName' => 'Fred F. User', 'active' => true, 'timeZone' => 'Australia/Sydney', '_links' => [ 'jiraRest' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', ], ], 'requestFieldValues' => [ [ 'fieldId' => 'summary', 'label' => 'What do you need?', 'value' => 'Request JSD help via REST', ], [ 'fieldId' => 'description', 'label' => 'Why do you need this?', 'value' => 'I need a new mouse for my Mac', ], ], 'currentStatus' => [ 'status' => 'Waiting for Support', 'statusDate' => [ 'iso8601' => '2015-10-08T14:01:00+0700', 'jira' => '2015-10-08T14:01:00.000+0700', 'friendly' => 'Today 14:01 PM', 'epochMillis' => 1444287660000, ], ], '_links' => [ 'jiraRest' => 'https://host:port/context/rest/api/2/issue/107001', 'web' => 'https://host:port/context/servicedesk/customer/portal/10/HELPDESK-1', 'self' => 'https://host:port/context/rest/servicedeskapi/request/107001', ], ];
Users
Resource
update
function
Modify user.
$client->users()->update(body: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/user/charlie', 'key' => 'charlie', 'name' => 'charlie', 'emailAddress' => 'charlie@atlassian.com', 'displayName' => 'Charlie of Atlassian', ];
create
function
Create user.
$client->users()->create(body: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/user/charlie', 'key' => 'charlie', 'name' => 'charlie', 'emailAddress' => 'charlie@atlassian.com', 'displayName' => 'Charlie of Atlassian', ];
remove
function
Remove user and its references (like project roles associations, watches, history).
$client->users()->remove(query: [...]);
response example
null
get
function
Return a user.
$client->users()->get(query: [...]);
response example
[ 'self' => 'https://www.example.com/jira/rest/api/2/user?username=fred', 'name' => 'fred', 'emailAddress' => 'fred@example.com', 'avatarUrls' => [ '48x48' => 'https://www.example.com/jira/secure/useravatar?size=large&ownerId=fred', '24x24' => 'https://www.example.com/jira/secure/useravatar?size=small&ownerId=fred', '16x16' => 'https://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred', '32x32' => 'https://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred', ], 'displayName' => 'Fred F. User', 'active' => true, 'timeZone' => 'Australia/Sydney', 'groups' => [ 'size' => 3, 'items' => [ [ 'name' => 'jira-user', 'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-user', ], [ 'name' => 'jira-admin', 'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=jira-admin', ], [ 'name' => 'important', 'self' => 'https://www.example.com/jira/rest/api/2/group?groupname=important', ], ], ], 'applicationRoles' => [ 'size' => 1, 'items' => [], ], 'expand' => 'groups,applicationRoles', ];
Contributing
Thank you for considering contributing to the Jira PHP! The contribution guide can be found in the CONTRIBUTING.
Security Vulnerabilities
If you discover any security-related issues, please email moath.alhajrii@gmail.com instead of using the issue tracker.
License
Jira PHP is an open-sourced software licensed under the MIT license.