Skip to content

agiftinside/php-adp-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PHP ADP Client

Latest Stable Version Total Downloads License

Getting started

composer require jlg/php-adp-client

Basic usage

<?php

$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 =  json_decode($adp->get('hr/v2/workers', $params));
$workers = ($httpResults) ? $httpResults->workers : [];

Methods

  • $adp->get($url, $requestPayload);: sends a GET request to which ever ADP API endpoint you would like to use.
  • $adp->post($url, $requestPayload);: sends a POST request to which ever ADP API endpoint you would like to use.
  • $adp->apiCall($requestType, $url, $requestPayload);: sends an HTTP request to which ADP API endpoint specified in the $url parameter.

Additional Information

  • Please refer to ADP API Documentation Explorer for additional details on request parameters and what to expect from the response.
  • This is using Guzzle for the Http abstraction. You will need to call ->getBody()->getContents() on the response from one of the methods listed above if you would like to get the contents of the ADP Api response.
  • If you are missing something in your config or any other type of validation, you will be met with an exception like this: PHP Fatal error: Uncaught Jlg\ADP\Exceptions\ADPClientValidationException: [0]: Missing keys from config: server_url

About

This is a simple php ADP client / connector

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%