PHP code example of kreait / personio

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

    

kreait / personio example snippets


use Kreait\Personio;

try {
    $app = Personio::initializeApp([
        'client_id' => getenv('PERSONIO_CLIENT_ID'),
        'client_secret' => getenv('PERSONIO_CLIENT_SECRET'),
        'debug' => false, // default
    ]);

    $employees = $app->getEmployees(); 
    $employee = $app->getEmployee($id);
    
    $timeOffs = $app->getTimeOffPeriods();
    $timeOff = $app->getTimeOffPeriod($id);
    
    
} catch (Personio\Error $e) {
    echo $e->getMessage();
}