Skip to content

Configuration

KwangSeob Jeong edited this page Jan 7, 2023 · 2 revisions

Configuration

you can choose loads environment variables either 'dotenv' or 'array'.

use dotenv

copy .env.example file to .env on your project root.

JIRAAPI_V3_HOST='https://your-jira.atlassian.net'
JIRAAPI_V3_USER='jira-username'
JIRAAPI_V3_PERSONAL_ACCESS_TOKEN='your-access-token-here'
## to enable session cookie authorization
# JIRAAPI_V3_COOKIE_AUTH_ENABLED=true
# JIRAAPI_V3_COOKIE_FILE=storage/jira-cookie.txt
## if you are behind a proxy, add proxy settings
JIRAAPI_V3_PROXY_SERVER='your-proxy-server'
JIRAAPI_V3_PROXY_PORT='proxy-port'
JIRAAPI_V3_PROXY_USER='proxy-username'
JIRAAPI_V3_PROXY_PASSWORD='proxy-password'

CAUTION this library not fully supported JIRA REST API V3 yet.

use array

create Service class with ArrayConfiguration parameter.

use JiraCloud\Configuration\ArrayConfiguration;
use JiraCloud\Issue\IssueService;

$iss = new IssueService(new ArrayConfiguration(
          [
               'jiraHost' => 'https://your-jira.atlassian.net',                                           
               'jiraUser' => 'jira-username',              
               'personalAccessToken' => 'your-token-here',
                
                // custom log config
               'jiraLogEnabled' => true,
               'jiraLogFile' => "my-jira-rest-client.log",
               'jiraLogLevel' => 'INFO',
        
               // to enable session cookie authorization (with basic authorization only)
               'cookieAuthEnabled' => true,
               'cookieFile' => storage_path('jira-cookie.txt'),
               // if you are behind a proxy, add proxy settings
               'proxyServer' => 'your-proxy-server',
               'proxyPort' => 'proxy-port',
               'proxyUser' => 'proxy-username',
               'proxyPassword' => 'proxy-password',
          ]
   ));