fiteco-group / kimai-client
Kimai V2 PHP Api client.
Requires
- php: >=7.2|>=8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^8.0 || ^9.0
This package is auto-updated.
Last update: 2025-03-06 04:23:18 UTC
README
JSON API for the Kimai 2 time-tracking software. Read more about its usage in the API documentation and then download a Swagger file for import e.g. in Postman. Be aware: it is not yet considered stable and BC breaks might happen, especially when using code generation. The order of JSON attributes is not guaranteed.
Installation & Usage
Requirements
PHP 7.2 and later.
Composer
To install the bindings via Composer, add the following to composer.json
:
{ "require": { "fiteco-group/kimai-client": "*@dev" } }
Then run composer install
Manual Installation
Download the files and include autoload.php
:
<?php require_once('/path/to/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure 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; }
API Endpoints
All URIs are relative to Kimai installation.
Class | Method | HTTP request | Description |
---|---|---|---|
ActivityApi | apiActivitiesGet | GET /api/activities | Returns a collection of activities |
ActivityApi | apiActivitiesIdGet | GET /api/activities/{id} | Returns one activity |
ActivityApi | apiActivitiesIdMetaPatch | PATCH /api/activities/{id}/meta | Sets the value of a meta-field for an existing activity |
ActivityApi | apiActivitiesIdPatch | PATCH /api/activities/{id} | Update an existing activity |
ActivityApi | apiActivitiesIdRatesGet | GET /api/activities/{id}/rates | Returns a collection of all rates for one activity |
ActivityApi | apiActivitiesIdRatesPost | POST /api/activities/{id}/rates | Adds a new rate to an activity |
ActivityApi | apiActivitiesIdRatesRateIdDelete | DELETE /api/activities/{id}/rates/{rateId} | Deletes one rate for an activity |
ActivityApi | apiActivitiesPost | POST /api/activities | Creates a new activity |
CustomerApi | apiCustomersGet | GET /api/customers | Returns a collection of customers |
CustomerApi | apiCustomersIdGet | GET /api/customers/{id} | Returns one customer |
CustomerApi | apiCustomersIdMetaPatch | PATCH /api/customers/{id}/meta | Sets the value of a meta-field for an existing customer |
CustomerApi | apiCustomersIdPatch | PATCH /api/customers/{id} | Update an existing customer |
CustomerApi | apiCustomersIdRatesGet | GET /api/customers/{id}/rates | Returns a collection of all rates for one customer |
CustomerApi | apiCustomersIdRatesPost | POST /api/customers/{id}/rates | Adds a new rate to a customer |
CustomerApi | apiCustomersIdRatesRateIdDelete | DELETE /api/customers/{id}/rates/{rateId} | Deletes one rate for an customer |
CustomerApi | apiCustomersPost | POST /api/customers | Creates a new customer |
DefaultApi | apiConfigI18nGet | GET /api/config/i18n | Returns the user specific locale configuration |
DefaultApi | apiConfigTimesheetGet | GET /api/config/timesheet | Returns the timesheet configuration |
DefaultApi | apiPingGet | GET /api/ping | A testing route for the API |
DefaultApi | apiPluginsGet | GET /api/plugins | Returns information about installed Plugins |
DefaultApi | apiVersionGet | GET /api/version | Returns information about the Kimai release |
ProjectApi | apiProjectsGet | GET /api/projects | Returns a collection of projects. |
ProjectApi | apiProjectsIdGet | GET /api/projects/{id} | Returns one project |
ProjectApi | apiProjectsIdMetaPatch | PATCH /api/projects/{id}/meta | Sets the value of a meta-field for an existing project |
ProjectApi | apiProjectsIdPatch | PATCH /api/projects/{id} | Update an existing project |
ProjectApi | apiProjectsIdRatesGet | GET /api/projects/{id}/rates | Returns a collection of all rates for one project |
ProjectApi | apiProjectsIdRatesPost | POST /api/projects/{id}/rates | Adds a new rate to an project |
ProjectApi | apiProjectsIdRatesRateIdDelete | DELETE /api/projects/{id}/rates/{rateId} | Deletes one rate for an project |
ProjectApi | apiProjectsPost | POST /api/projects | Creates a new project |
TagApi | apiTagsGet | GET /api/tags | Fetch all existing tags |
TagApi | apiTagsIdDelete | DELETE /api/tags/{id} | Delete a tag |
TagApi | apiTagsPost | POST /api/tags | Creates a new tag |
TeamApi | apiTeamsGet | GET /api/teams | Fetch all existing teams |
TeamApi | apiTeamsIdActivitiesActivityIdDelete | DELETE /api/teams/{id}/activities/{activityId} | Revokes access for an activity from a team |
TeamApi | apiTeamsIdActivitiesActivityIdPost | POST /api/teams/{id}/activities/{activityId} | Grant the team access to an activity |
TeamApi | apiTeamsIdCustomersCustomerIdDelete | DELETE /api/teams/{id}/customers/{customerId} | Revokes access for a customer from a team |
TeamApi | apiTeamsIdCustomersCustomerIdPost | POST /api/teams/{id}/customers/{customerId} | Grant the team access to a customer |
TeamApi | apiTeamsIdDelete | DELETE /api/teams/{id} | Delete a team |
TeamApi | apiTeamsIdGet | GET /api/teams/{id} | Returns one team |
TeamApi | apiTeamsIdMembersUserIdDelete | DELETE /api/teams/{id}/members/{userId} | Removes a member from the team |
TeamApi | apiTeamsIdMembersUserIdPost | POST /api/teams/{id}/members/{userId} | Add a new member to a team |
TeamApi | apiTeamsIdPatch | PATCH /api/teams/{id} | Update an existing team |
TeamApi | apiTeamsIdProjectsProjectIdDelete | DELETE /api/teams/{id}/projects/{projectId} | Revokes access for a project from a team |
TeamApi | apiTeamsIdProjectsProjectIdPost | POST /api/teams/{id}/projects/{projectId} | Grant the team access to a project |
TeamApi | apiTeamsPost | POST /api/teams | Creates a new team |
TimesheetApi | apiTimesheetsActiveGet | GET /api/timesheets/active | Returns the collection of active timesheet records |
TimesheetApi | apiTimesheetsGet | GET /api/timesheets | Returns a collection of timesheet records |
TimesheetApi | apiTimesheetsIdDelete | DELETE /api/timesheets/{id} | Delete an existing timesheet record |
TimesheetApi | apiTimesheetsIdDuplicatePatch | PATCH /api/timesheets/{id}/duplicate | Duplicates an existing timesheet record |
TimesheetApi | apiTimesheetsIdExportPatch | PATCH /api/timesheets/{id}/export | Switch the export state of a timesheet record to (un-)lock it |
TimesheetApi | apiTimesheetsIdGet | GET /api/timesheets/{id} | Returns one timesheet record |
TimesheetApi | apiTimesheetsIdMetaPatch | PATCH /api/timesheets/{id}/meta | Sets the value of a meta-field for an existing timesheet. |
TimesheetApi | apiTimesheetsIdPatch | PATCH /api/timesheets/{id} | Update an existing timesheet record |
TimesheetApi | apiTimesheetsIdRestartPatch | PATCH /api/timesheets/{id}/restart | Restarts a previously stopped timesheet record for the current user |
TimesheetApi | apiTimesheetsIdStopPatch | PATCH /api/timesheets/{id}/stop | Stops an active timesheet record |
TimesheetApi | apiTimesheetsPost | POST /api/timesheets | Creates a new timesheet record |
TimesheetApi | apiTimesheetsRecentGet | GET /api/timesheets/recent | Returns the collection of recent user activities |
UserApi | apiUsersGet | GET /api/users | Returns the collection of all registered users |
UserApi | apiUsersIdGet | GET /api/users/{id} | Return one user entity |
UserApi | apiUsersIdPatch | PATCH /api/users/{id} | Update an existing user |
UserApi | apiUsersMeGet | GET /api/users/me | Return the current user entity |
UserApi | apiUsersPost | POST /api/users | Creates a new user |
Models
- Activity
- ActivityCollection
- ActivityEditForm
- ActivityEntity
- ActivityExpanded
- ActivityMeta
- ActivityRate
- ActivityRateForm
- Customer
- CustomerCollection
- CustomerEditForm
- CustomerEntity
- CustomerMeta
- CustomerRate
- CustomerRateForm
- I18nConfig
- InlineObject
- InlineObject1
- InlineObject2
- InlineObject3
- InlineObject4
- Plugin
- Project
- ProjectCollection
- ProjectEditForm
- ProjectEntity
- ProjectExpanded
- ProjectMeta
- ProjectRate
- ProjectRateForm
- TagEditForm
- TagEntity
- Team
- TeamCollection
- TeamEditForm
- TeamEntity
- TimesheetCollection
- TimesheetCollectionExpanded
- TimesheetConfig
- TimesheetEditForm
- TimesheetEntity
- TimesheetEntityExpanded
- TimesheetMeta
- User
- UserCollection
- UserCreateForm
- UserEditForm
- UserEntity
- Version
Authorization
apiToken
- Type: API key
- API key parameter name: X-AUTH-TOKEN
- Location: HTTP header
apiUser
- Type: API key
- API key parameter name: X-AUTH-USER
- Location: HTTP header
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
0.6
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen