PHP code example of satun14 / redmine-api

1. Go to this page and download the library: Download satun14/redmine-api 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/ */

    

satun14 / redmine-api example snippets



// This file is generated by Composer
e.example.com', 'username', 'password');


// This file ships with php-redmine-api
example.com', 'username', 'password');



// For Composer users (this file is generated by Composer)
.
// S_KEY');
//-- OR --
$client = new Redmine\Client('http://redmine.example.com', 'username', 'password');

$client->user->all();
$client->user->listing();

$client->issue->create([
    'issue' => [
        'project_id'  => 'test',
        'subject'     => 'some subject',
        'description' => 'a long description blablabla',
        'assigned_to_id' => 123, // or 'assigned_to' => 'user1'
    ]
]);

// OR

$client->issue->create([
    'ticket' => [
        'issue' => [
            'project_id' => 'test',
            'tracker_id' => '1',
            'status_id' => '1',
            'subject' => 'subject',
            'description' => 'description',
        ],
        'contact' => [
            'email' => '[email protected]',
            'first_name' => 'first name'
        ]
    ]
], '/helpdesk/create_ticket.xml');

$client->issue->all([
    'limit' => 1000
]);


$client = new Redmine\Client('http://redmine.example.com', 'API_ACCESS_KEY');

// impersonate user
$client->setImpersonateUser('jsmith');

// create a time entry for jsmith
$client->time_entry->create($data);

// remove impersonation for further calls
$client->setImpersonateUser(null);