Setup

Prerequisites

Enable the REST Api for Redmine

Make sure that you have enabled your Redmine instance's REST API, and that you have generated an API key for a user. Review Redmine's official documentationopen in new window for details.

Setup Http Client package

To use this API Client, you are required to have setup the Http Client.

Register Service Provider

Register RedmineServiceProvider in your config/app.php configuration file.

return [

    // ... previous not shown ... //

    /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    */

    'providers' => [

        \Aedart\Redmine\Providers\RedmineServiceProvider::class

        // ... remaining services not shown ... //
    ],
];

Publish Assets (optional)

Run vendor:publish to publish this package's configuration.

php artisan vendor:publish

After the command has completed, you should see config/redmine.php in your application.

Publish Assets for Athenaeum Core Application

If you are using the Athenaeum Core Application, then run the following command to publish assets:

php {your-cli-app} vendor:publish-all

Configuration

Inside your config/redmine.php file, you can specify the "connections" profiles. These are nothing more than identifiers for what Http Client connection profile to be used.

By default, a "redmine" http client profile is expected to exist. Feel free to change this to whatever connection profile you wish. However, please know that only a connection profiles using the JsonHttpClient as driver can be used for the Redmine Clients.

In your config/http-clients.php

Add a dedicated Redmine profile (you can name it whatever your wish). Make sure to specify the base_uri to your Redmine server url.

return [

    // ...previous not shown ... 

    'profiles' => [

        'redmine' => [
            'driver' => \Aedart\Http\Clients\Drivers\JsonHttpClient::class,
            'options' => [

                'base_uri' => env('REDMINE_API_URI', 'https://your-redmine.com/'),
                
                // ...remaining not shown ...            
            ]
        ]
    ],
    
    // ...remaining not shown ... 
];

In your config/redmine.php

Make sure that you have specified the authentication setting (your API token).

return [

    // ...previous not shown ... 

    'connections' => [

        'default' => [

            'http_client' => 'redmine',

            /*
             | Redmine Authentication token. This option is automatically set as
             | the appropriate Http Header (X-Redmine-API-Key)
            */
            'authentication' => env('REDMINE_TOKEN')
        ]
    ]
];