This is a simple php ADP client / connector

Overview

Simple PHP ADP Client

Latest Stable Version Total Downloads License

Getting started

composer require jlg/php-adp-client

Basic usage

[ '$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 : [];">


$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

  • getWorkersMeta(): HttpResponse

    • sends a GET request to retrieve workers api meta data.
    $adp->getWorkersMeta();
  • getWorker(string $aoid, array $select = []): HttpResponse

    • gets a single worker based on workers AOID
    • an optional select array can be passed as a secondary argument.
    $adp->getWorker($aoid, $select);
  • getWorkers(array $filters = [], int $skip = 0, int $top = 100, bool $count = false, array $select = []): HttpResponse

    • gets all workers, but only returns $top records.
    • You can use the $skip as a way of moving through all your users.
    $adp->getWorkers($filters, $skip, $top, $count, $select);
    • or you may need to get more than $top
    getWorkers($filters, $skip, $top)) !== null) { $workers = array_merge($workers, $results->workers); $skip += $top; } return $workers;">
    $fn = fn ($res) => $res->getBody()->getContents(); // php 8 thing.
    
    $workers = [];
    $filters = ["workers/workAssignments/assignmentStatus/statusCode/codeValue eq 'A'"]; // you probably want to use a filter :)
    $top = 100;
    $skip = 0; 
    
    while (($results = $fn($adp->getWorkers($filters, $skip, $top)) !== null) {
        $workers = array_merge($workers, $results->workers);
        $skip += $top;
    }
    
    return $workers;
    • In the future there will be a static method that will wrap getting the contents.
    • In v1.1.2 => $results = $adp::getContents($adp->getWorkers())
  • getWorkAssignmentMeta(): HttpResponse

    • sends a GET request to retrieve Work-Assignment api meta data.
    $adp->getWorkAssignmentMeta();
  • static getContents(HttpResponse $response): HttpResponse

    • gets the contents from a guzzle Http Response.
    $res = $adp::getContents($adp->getWorkers());
  • modifyWorkAssignment(array $params = []): HttpResponse

    • sends a POST request to modify a workers work assignment.
    $adp->modifyWorkAssignment($params);
  • get(string $url, array $requestPayload = []): HttpResponse

    • sends a GET request to which ever ADP API endpoint you would like to use.
    $adp->get($url, $requestPayload);
  • post(string $url, array $requestPayload = []): HttpResponse

    • sends a POST request to which ever ADP API endpoint you would like to use.
    $adp->post($url, $requestPayload);
  • apiCall(string $requestType, string $url, array $requestPayload = []): HttpResponse

    • sends an HTTP request to which ADP API endpoint specified in the $url parameter.
    • $requestType needs to be either 'get' or 'put'
    $adp->apiCall('get', 'hr/v2/workers', []);

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
You might also like...
Google PHP API Client Services

Google PHP API Client Services

AltiriaSmsPhpClient, the official PHP client of Altiria
AltiriaSmsPhpClient, the official PHP client of Altiria

Altiria, cliente SMS PHP Altiria SMS PHP es un cliente que simplifica al máximo la integración de nuestro API para PHP. Por el momento, esta librería

PHP Client for the GoFlink API

GoFlink PHP API Client This project is an unofficial library to communicate with the GoFlink API from your PHP project. Documentation about the API is

A PHP client for the official Kizeo Forms API V3+. 📌

Kizeo Forms API V3+ - PHP This is a Swagger generated doc for Kizeo REST API 3. You can find additionnal documentation here : Online documentation. Th

Client for the Tenant Security Proxy in PHP

Tenant Security Client PHP Library A PHP client for implementing CMK within a vendor's infrastructure. Makes requests through an IronCore Tenant Secur

Shopee Open API v2 Client build with php

Shopee PHP Client This is a Shopee PHP Client, currently supported for API V2 in ShopeeOpenPlatform Composer Install composer require haistar/shopee-p

The official Previewify.app PHP Client
The official Previewify.app PHP Client

Previewify for PHP This is the official Previewify client for PHP. Support us Like our work? You can support us by purchasing one of our products. Ins

Production-ready, stable Kafka client for PHP

PHP Kafka client - php-rdkafka PHP-rdkafka is a stable, production-ready, long term support, and fast Kafka client for PHP based on librdkafka. It sup

VideoColor PHP Search Client
VideoColor PHP Search Client

This library is designed to find information about a movie and get the frame position using a screenshot from a video.

Releases(v1.2.4)
Owner
null
Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Google APIs 8.4k Dec 30, 2022
PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Sergey Bykov 63 Feb 14, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
A simple PHP GitHub API client, Object Oriented, tested and documented.

PHP GitHub API A simple Object Oriented wrapper for GitHub API, written with PHP. Uses GitHub API v3 & supports GitHub API v4. The object API (v3) is

KNP Labs 2k Jan 7, 2023
A simple Object Oriented PHP Client for Termii SMS API

Termii Client A simple Object Oriented PHP Client for Termii SMS API. Uses Termii API. Requirements PHP >= 7.2 Guzzlehttp ~6|~7 Installation Via Compo

Ilesanmi Olawale Adedotun 5 Feb 24, 2022
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Web3 PHP 665 Dec 23, 2022
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit 96 Jan 6, 2023
PHP client for Kafka

A library to allow people to communicate to Kafka using plain PHP, compatible with Kafka v0.11+ (due to the way the protocol works).

Luís Cobucci 52 Dec 23, 2022
php 8 client for the lemon.markets api

lemon.markets php client This repository contains a php 8+ compatible client for the https://lemon.markets API. The documentation of the API can be fo

Daniel Freudenberger 4 Nov 17, 2022
PHP client for Microsoft Azure Face API.

Microsoft Azure Face API PHP client A PHP library that utilizes Azure Face REST API. Requirements PHP >= 7.4 Installation composer require darmen/php-

Darmen Amanbayev 6 Sep 14, 2022