arkon-event/codereadr-api-client

API Client for codereadr

v2.0.2 2019-04-18 08:34 UTC

This package is not auto-updated.

Last update: 2020-08-08 05:25:59 UTC


README

PHP client for interacting with CodeReadr API. See https://www.codereadr.com/apidocs/ for details.

Note that this package (as of v2) requires PHP 7.2

<?php
use ArkonEvent\CodeReadr\ApiClient\Client;
$client = new Client('youAPIKey');

//Example get all users and print usernames
try{
   $responseXML = $client->request(Client::SECTION_USERS, Client::ACTION_RETREIVE);
   //Response is a \SimpleXMLElement object
   foreach ($responseXML->user as $user){
   echo 'username: '.$user->username.PHP_EOL;
   }
} catch(\Throwable $e){
   echo 'API error: '.$e->getMessage();
}