PHP code example of fiteco-group / kimai-client

1. Go to this page and download the library: Download fiteco-group/kimai-client 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/ */

    

fiteco-group / kimai-client example snippets





onfigure host on which Kimai is running
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setHost('https://kimai.RememberToSetMe.com');

// Configure API key authorization: apiToken
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKey('X-AUTH-TOKEN', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-AUTH-TOKEN', 'Bearer');

// Configure API key authorization: apiUser
$config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKey('X-AUTH-USER', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Fiteco\KimaiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-AUTH-USER', 'Bearer');


$apiInstance = new Fiteco\KimaiClient\Api\ActivityApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project = 'project_example'; // string | Project ID to filter activities
$projects = 'projects_example'; // string | Comma separated list of project IDs to filter activities
$visible = 'visible_example'; // string | Visibility status to filter activities. Allowed values: 1=visible, 2=hidden, 3=all (default: 1)
$globals = 'globals_example'; // string | Use if you want to fetch only global activities. Allowed values: true (default: false)
$globalsFirst = 'globalsFirst_example'; // string | Deprecated parameter, value is not used any more
$orderBy = 'orderBy_example'; // string | The field by which results will be ordered. Allowed values: id, name, project (default: name)
$order = 'order_example'; // string | The result order. Allowed values: ASC, DESC (default: ASC)
$term = 'term_example'; // string | Free search term

try {
    $result = $apiInstance->apiActivitiesGet($project, $projects, $visible, $globals, $globalsFirst, $orderBy, $order, $term);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ActivityApi->apiActivitiesGet: ', $e->getMessage(), PHP_EOL;
}