studiocreativateam / desktime
1.0.0
2022-01-30 13:14 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.0
This package is auto-updated.
Last update: 2024-09-29 06:14:40 UTC
README
desktime.com API 的 PHP 库。
您需要获取您的 API 密钥值。您可以在以下位置找到您的 api_key 值: https://desktime.com/app/api
示例
$Account = new Account();
$Account->setCredentials(['api_key' => 'API_KEY_HERE']);
$company = $Account->company();
print_r($company);
stdClass Object
(
[pass] => 1
[code] => 200
[body] => stdClass Object
(
[name] => Company name
[work_starts] => 07:15:00
[work_ends] => 18:00:00
[work_duration] => 28800
[working_days] => 79
[work_start_tracking] => 07:00:00
[work_stop_tracking] => 22:45:00
[timezone_identifier] => Asia/Riyadh
[__request_time] => 1578933311
)
)
您可以获取所有员工或 api_key 的员工所有者。
$Employee = new Employee();
$Employee->setCredentials(['api_key' => 'API_KEY_HERE']);
// Getting all employees.
// $all = $Employee->all(['date' => '2019-11-13', 'period' => 'month']); //.
$all_employees = $Employee->all();
print_r($all_employees);
// Getting current employee. (the owner of this API key)
$current_employee = $Employee->get();
print_r($current_employee);
// Load employee data by his Desktime email.
$email = 'email@example.com';
$employee = $Employee->getEmployeeByEmail($email);
print_r($employee);