PHP code example of duffleman / crpc
1. Go to this page and download the library: Download duffleman/crpc 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/ */
duffleman / crpc example snippets
uffleman\crpc;
// important trailing slash here
$c = new crpc\crpc('https://api.avocado.cuv-nonprod.app/1/service-staff/', [
'headers' => ['Authorization' => '... keys here'],
]);
$res = $c->do('1/latest/list_staff', [
'showPastEmployees' => true, // converted to snake case
]);
foreach ($res as $staff) {
$staff = (object) $staff;
$staff->about = (object) $staff->about; // only because I prefer -> to array accessors
if (!$staff->isActive) { // converted from snake case
echo '!! ';
}
echo "{$staff->about->name} ({$staff->about->role})";
echo "\n";
}