PHP code example of kasper334 / peopleforce-sdk
1. Go to this page and download the library: Download kasper334/peopleforce-sdk 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/ */
kasper334 / peopleforce-sdk example snippets
use Kasper334\PeopleforceSdk\API;
use Kasper334\PeopleforceSdk\Entities\LeaveRequest;
$api = new API('PEOPLEFORCE_API_KEY');
$pendingLeaveRequests = $api->leaveRequests->getAll([
'states' => [LeaveRequest::STATE_PENDING],
'employee_ids' => [12345],
'starts_on' => '2021-01-01',
'ends_on' => '2021-01-31',
]);
$employees = $api->employees->getAll();
$someEmployee = $api->employees->get(112233);
$someEmployeeLeaveBalances = $api->employees->leaveBalances->get(112233);
$someEmployeeEmergencyContacts = $api->employees->emergencyContacts->get(112233);
$todayCalendarEvents = $api->calendars->getAll([
'starts_on' => '2021-09-19',
'ends_on' => '2021-09-19',
]);
$teams = $api->teams->getAll();
$leaveTypes = $api->leaveTypes->getAll();