PHP code example of jlg / php-adp-client

1. Go to this page and download the library: Download jlg/php-adp-client 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/ */

    

jlg / php-adp-client example snippets




$config = [
    'client_id'     => '********-****-****-****-************',
    'client_secret' => '********-****-****-****-************',
    'org_name'      => 'ADP Org Name',
    'ssl_cert_path' => '/etc/ssl/adp/company_auth.pem',
    'ssl_key_path'  => '/etc/ssl/adp/company_auth.key',
    'server_url'    => 'https://api.adp.com/'
];

$adp = new \Jlg\ADP\Client($config);

$filter = "workers/workAssignments/assignmentStatus/statusCode/codeValue eq 'A'";
$params = [
    'query' => [
        '$filter' => $filter,
        '$top'    => 100, // amount of records to grab
        '$skip'   => 0 // how many records to skip.
    ]
];

$httpResults =  $adp::getContents($adp->get('hr/v2/workers', $params));
$workers = ($httpResults) ? $httpResults->workers : [];
 
     $adp->getWorkersMeta();
     

     $adp->getWorker($aoid, $select);
     

     $adp->getWorkers($filters, $skip, $top, $count, $select);
     
     
     $workers = [];
     $filters = ["workers/workAssignments/assignmentStatus/statusCode/codeValue eq 'A'"]; // you probably want to use a filter :)
     $top = 100;
     $skip = 0; 
     
     while (($results = $adp::getContents($adp->getWorkers($filters, $skip, $top))) !== null) {
         $workers = array_merge($workers, $results->workers);
         $skip += $top;
     }
     
     return $workers;
     

     $adp->getWorkAssignmentMeta();
     

     $adp->modifyWorkAssignment($params);
     

     $adp->get($url, $requestPayload);
     

     $adp->post($url, $requestPayload);
     

     $adp->apiCall('get', 'hr/v2/workers', []);
     

    $res = $adp::getContents($adp->getWorkers());
    
zsh
composer